consolidating page posts into a function comicpress_display_page_post()

Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
Philip M. Hofer (Frumph) 2009-12-23 10:43:05 -08:00
parent 160539e223
commit 02e0a9f66f
15 changed files with 79 additions and 243 deletions

View File

@ -70,27 +70,7 @@ $month['12'] = array('month' => __('December','comicpress'), 'days' => '31');
<?php while (have_posts()) : the_post() ?>
<div class="<?php comicpress_post_class(); ?>">
<?php if (function_exists('has_post_thumbnail')) {
if ( has_post_thumbnail() ) { ?>
<div class="post-page-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_post_thumbnail('full'); ?></a>
</div>
<?php }
} ?>
<div class="post-page-head"></div>
<div class="post-page">
<?php if (!$comicpress_options['disable_page_titles']) { ?>
<h2 class="pagetitle"><?php the_title() ?></h2>
<?php } ?>
<div class="entry">
<?php the_content(); ?>
</div>
<br class="clear-margins" />
<?php edit_post_link(__('Edit this page.','comicpress'), '<p>', '</p>') ?>
</div>
<div class="post-page-foot"></div>
</div>
<?php comicpress_display_page_post(); ?>
<?php endwhile; ?>

View File

@ -6,30 +6,12 @@ Template Name: This Month of Comics
<?php get_header(); ?>
<?php include(get_template_directory() . '/layout-head.php'); ?>
<?php while (have_posts()) : the_post() ?>
<div class="<?php comicpress_post_class(); ?>">
<?php if (function_exists('has_post_thumbnail')) {
if ( has_post_thumbnail() ) { ?>
<div class="post-page-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_post_thumbnail('full'); ?></a>
</div>
<?php }
} ?>
<div class="post-page-head"></div>
<div class="post-page">
<?php if (!$comicpress_options['disable_page_titles']) { ?>
<h2 class="pagetitle"><?php the_title() ?></h2>
<?php } ?>
<div class="entry">
<?php the_content(); ?>
</div>
<br class="clear-margins" />
<?php edit_post_link(__('Edit this page.','comicpress'), '<p>', '</p>') ?>
</div>
<div class="post-page-foot"></div>
</div>
<?php endwhile;
<?php
if (have_posts()) {
while (have_posts()) : the_post();
comicpress_display_page_post();
endwhile;
}
//based on Austin Matzko's code from wp-hackers email list
function filter_where($where = '') {

View File

@ -6,31 +6,13 @@ Template Name: Comic Storyline with Thumbs
<?php get_header(); ?>
<?php include(get_template_directory() . '/layout-head.php'); ?>
<?php while (have_posts()) : the_post() ?>
<div class="<?php comicpress_post_class(); ?>">
<?php if (function_exists('has_post_thumbnail')) {
if ( has_post_thumbnail() ) { ?>
<div class="post-page-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_post_thumbnail('full'); ?></a>
</div>
<?php }
} ?>
<div class="post-page-head"></div>
<div class="post-page">
<?php if (!$comicpress_options['disable_page_titles']) { ?>
<h2 class="pagetitle"><?php the_title() ?></h2>
<?php } ?>
<div class="entry">
<?php the_content(); ?>
</div>
<br class="clear-margins" />
<?php edit_post_link(__('Edit this page.','comicpress'), '<p>', '</p>') ?>
</div>
<div class="post-page-foot"></div>
</div>
<?php endwhile; ?>
<?php
if (have_posts()) {
while (have_posts()) : the_post();
comicpress_display_page_post();
endwhile;
}
?>
<div class="<?php comicpress_post_class(); ?>">
<div class="post-page-head"></div>

View File

@ -6,31 +6,13 @@ Template Name: Comic Storyline Archive
<?php get_header(); ?>
<?php include(get_template_directory() . '/layout-head.php'); ?>
<?php while (have_posts()) : the_post() ?>
<div class="<?php comicpress_post_class(); ?>">
<?php if (function_exists('has_post_thumbnail')) {
if ( has_post_thumbnail() ) { ?>
<div class="post-page-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_post_thumbnail('full'); ?></a>
</div>
<?php }
} ?>
<div class="post-page-head"></div>
<div class="post-page">
<?php if (!$comicpress_options['disable_page_titles']) { ?>
<h2 class="pagetitle"><?php the_title() ?></h2>
<?php } ?>
<div class="entry">
<?php the_content(); ?>
</div>
<br class="clear-margins" />
<?php edit_post_link(__('Edit this page.','comicpress'), '<p>', '</p>') ?>
</div>
<div class="post-page-foot"></div>
</div>
<?php endwhile; ?>
<?php
if (have_posts()) {
while (have_posts()) : the_post();
comicpress_display_page_post();
endwhile;
}
?>
<div class="<?php comicpress_post_class(); ?>">
<div class="post-page-head"></div>

View File

@ -17,31 +17,13 @@ if (isset($_REQUEST['archive_year'])) {
if (empty($archive_year) || $archive_year == '') $archive_year = date('Y');
?>
<?php while (have_posts()) : the_post() ?>
<div class="<?php comicpress_post_class(); ?>">
<?php if (function_exists('has_post_thumbnail')) {
if ( has_post_thumbnail() ) { ?>
<div class="post-page-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_post_thumbnail('full'); ?></a>
</div>
<?php }
} ?>
<div class="post-page-head"></div>
<div class="post-page">
<?php if (!$comicpress_options['disable_page_titles']) { ?>
<h2 class="pagetitle"><?php the_title() ?></h2>
<?php } ?>
<div class="entry">
<?php the_content(); ?>
</div>
<br class="clear-margins" />
<?php edit_post_link(__('Edit this page.','comicpress'), '<p>', '</p>') ?>
</div>
<div class="post-page-foot"></div>
</div>
<?php endwhile; ?>
<?php
if (have_posts()) {
while (have_posts()) : the_post();
comicpress_display_page_post();
endwhile;
}
?>
<div class="<?php comicpress_post_class(); ?>">
<div class="post-page-head"></div>

View File

@ -6,31 +6,13 @@ Template Name: Comic Archive
<?php get_header(); ?>
<?php include(get_template_directory() . '/layout-head.php'); ?>
<?php while (have_posts()) : the_post() ?>
<div class="<?php comicpress_post_class(); ?>">
<?php if (function_exists('has_post_thumbnail')) {
if ( has_post_thumbnail() ) { ?>
<div class="post-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_post_thumbnail('full'); ?></a>
</div>
<?php }
} ?>
<div class="post-page-head"></div>
<div class="post-page">
<?php if (!$comicpress_options['disable_page_titles']) { ?>
<h2 class="pagetitle"><?php the_title() ?></h2>
<?php } ?>
<div class="entry">
<?php the_content(); ?>
</div>
<br class="clear-margins" />
<?php edit_post_link(__('Edit this page.','comicpress'), '<p>', '</p>') ?>
</div>
<div class="post-page-foot"></div>
</div>
<?php endwhile; ?>
<?php
if (have_posts()) {
while (have_posts()) : the_post();
comicpress_display_page_post();
endwhile;
}
?>
<?php
$years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date DESC");

View File

@ -6,31 +6,13 @@ Template Name: Archives
<?php get_header(); ?>
<?php include(get_template_directory() . '/layout-head.php'); ?>
<?php while (have_posts()) : the_post() ?>
<div class="<?php comicpress_post_class(); ?>">
<?php if (function_exists('has_post_thumbnail')) {
if ( has_post_thumbnail() ) { ?>
<div class="post-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_post_thumbnail('full'); ?></a>
</div>
<?php }
} ?>
<div class="post-page-head"></div>
<div class="post-page">
<?php if (!$comicpress_options['disable_page_titles']) { ?>
<h2 class="pagetitle"><?php the_title() ?></h2>
<?php } ?>
<div class="entry">
<?php the_content(); ?>
</div>
<br class="clear-margins" />
<?php edit_post_link(__('Edit this page.','comicpress'), '<p>', '</p>') ?>
</div>
<div class="post-page-foot"></div>
</div>
<?php endwhile; ?>
<?php
if (have_posts()) {
while (have_posts()) : the_post();
comicpress_display_page_post();
endwhile;
}
?>
<div class="<?php comicpress_post_class(); ?>">
<div class="post-page-head"></div>

View File

@ -12,6 +12,7 @@
<h2><?php _e('No such author.','comicpress'); ?></h2>
<?php } else { ?>
<div class="<?php comicpress_post_class(); ?>">
<?php comicpress_display_post_thumbnail(); ?>
<div class="post-page-head"></div>
<div class="post-page">
<div class="userpage-avatar">

View File

@ -17,6 +17,7 @@ Template Version: 2.14
$post = & get_post( $comicnum );
?>
<div class="<?php comicpress_post_class(); ?>">
<?php comicpress_display_post_thumbnail(); ?>
<div class="post-page-head"></div>
<div class="post-page">
<?php if (!$comicpress_options['disable_page_titles']) { ?>
@ -97,13 +98,7 @@ Template Version: 2.14
<?php while (have_posts()) : the_post() ?>
<div class="<?php comicpress_post_class(); ?>">
<?php if (function_exists('has_post_thumbnail')) {
if ( has_post_thumbnail() ) { ?>
<div class="post-page-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_post_thumbnail('full'); ?></a>
</div>
<?php }
} ?>
<?php comicpress_display_post_thumbnail(); ?>
<div class="post-page-head"></div>
<div class="post-page">
<?php if (!$comicpress_options['disable_page_titles']) { ?>

View File

@ -40,7 +40,7 @@ function comicpress_notice_debug() {
$non_comic_categories = str_replace(' and ', ',', $non_comic_categories);
$blog_query = '&show_posts=-1&posts_per_page=-1&cat='.$non_comic_categories;
$post = query_posts($blog_query);
query_posts($blog_query);
if (have_posts()) {
while (have_posts()) : the_post();
if (in_comic_category()) {

View File

@ -24,13 +24,7 @@ function display_comic_post($frontpage = 0) {
} ?>
<div class="<?php comicpress_post_class(); ?>">
<?php if (function_exists('has_post_thumbnail')) {
if ( has_post_thumbnail() ) { ?>
<div class="post-comic-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_post_thumbnail('full'); ?></a>
</div>
<?php }
} ?>
<?php comicpress_display_post_thumbnail(); ?>
<div class="post-comic-head"></div>
<div class="post-comic" id="post-comic-<?php the_ID() ?>">
<div class="post-comic-info">

View File

@ -100,5 +100,27 @@ function comicpress_display_post() {
<?php
}
function comicpress_display_page_post() {
global $post, $wp_query, $comicpress_options; ?>
<div class="<?php comicpress_post_class(); ?>">
<?php comicpress_display_post_thumbnail(); ?>
<div class="post-page-head"></div>
<div class="post-page">
<?php if (!$comicpress_options['disable_page_titles']) { ?>
<h2 class="pagetitle"><?php the_title() ?></h2>
<?php } ?>
<div class="entry">
<?php the_content(); ?>
</div>
<br class="clear-margins" />
<?php wp_link_pages(array('before' => '<div class="linkpages"><span class="linkpages-pagetext">'.__('Pages:','comicpress').'</span> ', 'after' => '</div>', 'next_or_number' => 'number')); ?>
<br class="clear-margins" />
<?php edit_post_link(__('Edit this page.','comicpress'), '<p>', '</p>') ?>
</div>
<div class="post-page-foot"></div>
</div>
<?php
}
?>

View File

@ -3,15 +3,9 @@
<?php if (have_posts()) : while (have_posts()) : the_post() ?>
<div class="<?php comicpress_post_class(); ?>">
<?php comicpress_display_post_thumbnail(); ?>
<div class="post-page-head"></div>
<div class="post-page" id="post-<?php the_ID() ?>">
<?php if (function_exists('the_post_thumbnail')) {
if ( has_post_thumbnail() ) { ?>
<div class="post-page-image">
<?php the_post_thumbnail('full'); ?>
</div>
<?php } ?>
<?php } ?>
<?php if (!$comicpress_options['disable_page_titles']) { ?>
<h2 class="pagetitle"><?php the_title() ?></h2>
<?php } ?>
@ -52,9 +46,7 @@
<div class="clear"></div>
</div>
<?php the_content() ?>
<?php if ('open' == $post->comment_status) {
comments_template('', true);
} ?>
<?php if ('open' == $post->comment_status) { comments_template('', true); } ?>
<br class="clear-margins" />
</div>
<div class="post-page-foot"></div>

View File

@ -6,31 +6,13 @@ Template Name: Links
<?php get_header(); ?>
<?php include(get_template_directory() . '/layout-head.php'); ?>
<?php while (have_posts()) : the_post() ?>
<div class="<?php comicpress_post_class(); ?>">
<?php if (function_exists('has_post_thumbnail')) {
if ( has_post_thumbnail() ) { ?>
<div class="post-page-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_post_thumbnail('full'); ?></a>
</div>
<?php }
} ?>
<div class="post-page-head"></div>
<div class="post-page">
<?php if (!$comicpress_options['disable_page_titles']) { ?>
<h2 class="pagetitle"><?php the_title() ?></h2>
<?php } ?>
<div class="entry">
<?php the_content(); ?>
</div>
<br class="clear-margins" />
<?php edit_post_link(__('Edit this page.','comicpress'), '<p>', '</p>') ?>
</div>
<div class="post-page-foot"></div>
</div>
<?php endwhile; ?>
<?php
if (have_posts()) {
while (have_posts()) : the_post();
comicpress_display_page_post();
endwhile;
}
?>
<?php
$linkcatid = get_term_by('name','menubar','link_category');

View File

@ -3,29 +3,7 @@
<?php while (have_posts()) : the_post() ?>
<div class="<?php comicpress_post_class(); ?>">
<?php if (function_exists('has_post_thumbnail')) {
if ( has_post_thumbnail() ) { ?>
<div class="post-page-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_post_thumbnail('full'); ?></a>
</div>
<?php }
} ?>
<div class="post-page-head"></div>
<div class="post-page">
<?php if (!$comicpress_options['disable_page_titles']) { ?>
<h2 class="pagetitle"><?php the_title() ?></h2>
<?php } ?>
<div class="entry">
<?php the_content(); ?>
</div>
<br class="clear-margins" />
<?php wp_link_pages(array('before' => '<div class="linkpages"><span class="linkpages-pagetext">'.__('Pages:','comicpress').'</span> ', 'after' => '</div>', 'next_or_number' => 'number')); ?>
<br class="clear-margins" />
<?php edit_post_link(__('Edit this page.','comicpress'), '<p>', '</p>') ?>
</div>
<div class="post-page-foot"></div>
</div>
<?php comicpress_display_page_post(); ?>
<?php endwhile; ?>