breaking out page content into partials

This commit is contained in:
John Bintz 2009-07-12 19:39:38 -04:00
parent 4a15725d3f
commit 5ea778d8f2
7 changed files with 137 additions and 111 deletions

View File

@ -15,34 +15,7 @@
<div id="content" class="narrowcolumn">
<?php if (!is_paged()) { ?>
<div class="post-comic-head"></div>
<div class="post-comic">
<?php include(dirname(__FILE__) . '/partials/nav.inc') ?>
<div class="comicdate">
<?php the_date('F jS, Y') ?>
</div>
<div class="clear"></div>
<?php if (get_option('comicpress-enable-storyline-support') == 1) { ?>
<ul class="storyline-cats"><li class="storyline-root"><?php the_category(' &raquo; </li><li>', multiple) ?></li></ul>
<?php } ?>
<h2>
<a href="<?php get_permalink($last_comic_post->ID) ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'comicpress'), get_the_title()) ?>"><?php the_title() ?></a>
</h2>
<div class="entry">
<?php the_content('&darr; Read the rest of this entry...') ?>
</div>
<?php the_transcript('styled') ?>
<div class="tags">
<?php the_tags('&#9492; Tags: ', ', ', ''); edit_post_link('Edit Post', ' [ ', ' ] ') ?>
</div>
<div class="comment-link">
<?php if ('open' == $post->comment_status) { comments_popup_link('&ldquo;Comment&rdquo;', '&ldquo;1 Comment&rdquo;', '&ldquo;% Comments&rdquo;'); } ?>
</div>
<br class="clear-margins" />
</div>
<div class="post-comic-foot"></div>
<?php } ?>
<?php if (!is_paged()) { include(dirname(__FILE__) . '/partials/index-comic-post.inc'); } ?>
<div id="blogheader"><!-- This area can be used for a heading above your main page blog posts --></div>
@ -58,28 +31,10 @@
);
while ($wp_query->have_posts()) {
$wp_query->the_post() ?>
<div class="post-head"></div>
<div class="post" id="post-<?php the_ID() ?>">
<h3>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'comicpress'), get_the_title()) ?>"><?php the_title() ?></a>
</h3>
<div class="postdate">
<?php the_time('F jS, Y') ?>
</div>
<div class="entry">
<?php the_content(__('&darr; Read the rest of this entry...', 'comicpress')) ?>
</div>
<div class="tags">
<?php the_tags(__('&#9492; Tags: ', 'comicpress'), ', ', ''); edit_post_link(__('Edit Post', 'comicpress'), ' [ ', ' ] ') ?>
</div>
<div class="comment-link">
<?php if ('open' == $post->comment_status) { comments_popup_link(__('&ldquo;Comment&rdquo;', 'comicpress'), __('&ldquo;1 Comment&rdquo;', 'comicpress'), __('&ldquo;% Comments&rdquo;', 'comicpress')); } ?>
</div>
<div class="clear-margins"><br /></div>
</div>
<div class="post-foot"></div>
<?php } ?>
$wp_query->the_post();
include(dirname(__FILE__) . '/partials/index-blog-post.inc');
}
?>
<div class="pagenav">
<div class="pagenav-right"><?php previous_posts_link(__('Newer Entries &uarr;', 'comicpress')) ?></div>

View File

@ -0,0 +1,20 @@
<div class="post-head"></div>
<div class="post" id="post-<?php the_ID() ?>">
<h3>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'comicpress'), get_the_title()) ?>"><?php the_title() ?></a>
</h3>
<div class="postdate">
<?php the_time('F jS, Y') ?>
</div>
<div class="entry">
<?php the_content(__('&darr; Read the rest of this entry...', 'comicpress')) ?>
</div>
<div class="tags">
<?php the_tags(__('&#9492; Tags: ', 'comicpress'), ', ', ''); edit_post_link(__('Edit Post', 'comicpress'), ' [ ', ' ] ') ?>
</div>
<div class="comment-link">
<?php if ('open' == $post->comment_status) { comments_popup_link(__('&ldquo;Comment&rdquo;', 'comicpress'), __('&ldquo;1 Comment&rdquo;', 'comicpress'), __('&ldquo;% Comments&rdquo;', 'comicpress')); } ?>
</div>
<div class="clear-margins"><br /></div>
</div>
<div class="post-foot"></div>

View File

@ -0,0 +1,26 @@
<div class="post-comic-head"></div>
<div class="post-comic">
<?php include('nav.inc') ?>
<div class="comicdate">
<?php the_date('F jS, Y') ?>
</div>
<div class="clear"></div>
<?php if (get_option('comicpress-enable-storyline-support') == 1) { ?>
<ul class="storyline-cats"><li class="storyline-root"><?php the_category(' &raquo; </li><li>', multiple) ?></li></ul>
<?php } ?>
<h2>
<a href="<?php get_permalink($last_comic_post->ID) ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'comicpress'), get_the_title()) ?>"><?php the_title() ?></a>
</h2>
<div class="entry">
<?php the_content('&darr; Read the rest of this entry...') ?>
</div>
<?php the_transcript('styled') ?>
<div class="tags">
<?php the_tags('&#9492; Tags: ', ', ', ''); edit_post_link('Edit Post', ' [ ', ' ] ') ?>
</div>
<div class="comment-link">
<?php if ('open' == $post->comment_status) { comments_popup_link('&ldquo;Comment&rdquo;', '&ldquo;1 Comment&rdquo;', '&ldquo;% Comments&rdquo;'); } ?>
</div>
<br class="clear-margins" />
</div>
<div class="post-comic-foot"></div>

26
partials/nav.inc Normal file
View File

@ -0,0 +1,26 @@
<div class="nav">
<?php if ($nav_comics['show_first']) { ?>
<div class="nav-first">
<a href="<?php echo get_permalink($nav_comics['first']->ID) ?>"
title="<?php _e('Go to the first comic', 'comicpress') ?>">&lsaquo;&lsaquo; <?php _e('First', 'comicpress') ?></a>
</div>
<?php } ?>
<?php if ($nav_comics['show_previous']) { ?>
<div class="nav-previous">
<a href="<?php echo get_permalink($nav_comics['previous']->ID) ?>"
title="<?php _e('Go to the previous comic', 'comicpress') ?>">&lsaquo; <?php _e('Previous', 'comicpress') ?></a>
</div>
<?php } ?>
<?php if ($nav_comics['show_next']) { ?>
<div class="nav-first">
<a href="<?php echo get_permalink($nav_comics['next']->ID) ?>"
title="<?php _e('Go to the next comic', 'comicpress') ?>"><?php _e('Next', 'comicpress') ?> &rsaquo;</a>
</div>
<?php } ?>
<?php if ($nav_comics['show_last']) { ?>
<div class="nav-previous">
<a href="<?php echo get_permalink($nav_comics['last']->ID) ?>"
title="<?php _e('Go to the last comic', 'comicpress') ?>"><?php _e('Last', 'comicpress') ?> &rsaquo;&rsaquo;</a>
</div>
<?php } ?>
</div>

View File

@ -0,0 +1,20 @@
<div class="post-head"></div>
<div class="post" id="post-<?php the_ID() ?>">
<div class="nav-blog">
<div class="nav-blog-previous"><?php previous_post_link('%link','&lsaquo; Previous', TRUE) ?></div>
<div class="nav-blog-next"><?php next_post_link('%link','Next &rsaquo;', TRUE) ?></div>
</div>
<div class="clear"></div>
<h2><?php the_title() ?></h2>
<div class="postdate"><?php the_time('F jS, Y') ?></div>
<div class="entry">
<?php the_content() ?>
<?php the_transcript('styled') ?>
<div class="tags">
<?php the_tags('&#9492; Tags: ', ', ', ''); edit_post_link('Edit Post', ' [ ', ' ] ') ?>
</div>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')) ?>
</div>
<br class="clear-margins" />
</div>
<div class="post-foot"></div>

View File

@ -0,0 +1,21 @@
<div class="post-comic-head"></div>
<div class="post-comic" id="post-<?php the_ID() ?>">
<div class="comicdate">
<?php include('nav.inc') ?>
<?php the_time('F jS, Y') ?>
</div>
<?php if (get_option('comicpress-enable-storyline-support') == 1) { ?>
<ul class="storyline-cats"><li class="storyline-root"><?php the_category(' &raquo; </li><li>', 'multiple') ?></li></ul>
<?php } ?>
<h2><?php the_title() ?></h2>
<div class="entry">
<?php the_content() ?>
<?php the_transcript('styled') ?>
<div class="tags">
<?php the_tags('&#9492; Tags: ', ', ', ''); edit_post_link('Edit Post', ' [ ', ' ] ') ?>
</div>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')) ?>
</div>
<br class="clear-margins" />
</div>
<div class="post-comic-foot"></div>

View File

@ -17,68 +17,26 @@
?>
<div id="content" class="narrowcolumn">
<?php if (have_posts()) { ?>
<?php while (have_posts()) { the_post() ?>
<?php if (in_comic_category()) { ?>
<div class="post-comic-head"></div>
<div class="post-comic" id="post-<?php the_ID() ?>">
<div class="comicdate">
<?php include(dirname(__FILE__) . '/partials/nav.inc') ?>
<?php the_time('F jS, Y') ?>
</div>
<?php if (get_option('comicpress-enable-storyline-support') == 1) { ?>
<ul class="storyline-cats"><li class="storyline-root"><?php the_category(' &raquo; </li><li>', 'multiple') ?></li></ul>
<?php } ?>
<h2><?php the_title() ?></h2>
<div class="entry">
<?php the_content() ?>
<?php the_transcript('styled') ?>
<div class="tags">
<?php the_tags('&#9492; Tags: ', ', ', ''); edit_post_link('Edit Post', ' [ ', ' ] ') ?>
</div>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')) ?>
</div>
<br class="clear-margins" />
</div>
<div class="post-comic-foot"></div>
<?php } else { ?>
<div class="post-head"></div>
<div class="post" id="post-<?php the_ID() ?>">
<div class="nav-blog">
<div class="nav-blog-previous"><?php previous_post_link('%link','&lsaquo; Previous', TRUE) ?></div>
<div class="nav-blog-next"><?php next_post_link('%link','Next &rsaquo;', TRUE) ?></div>
</div>
<div class="clear"></div>
<h2><?php the_title() ?></h2>
<div class="postdate"><?php the_time('F jS, Y') ?></div>
<div class="entry">
<?php the_content() ?>
<?php the_transcript('styled') ?>
<div class="tags">
<?php the_tags('&#9492; Tags: ', ', ', ''); edit_post_link('Edit Post', ' [ ', ' ] ') ?>
</div>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')) ?>
</div>
<br class="clear-margins" />
</div>
<div class="post-foot"></div>
<?php } ?>
<?php comments_template() ?>
<?php
if (have_posts()) {
while (have_posts()) { the_post();
if (in_comic_category()) {
include(dirname(__FILE__) . '/partials/single-comic-post.inc');
} else {
include(dirname(__FILE_) . '/partials/single-blog-post.inc');
}
comments_template();
}
} else { ?>
<div class="post-head"></div>
<div class="post">
<p>Sorry, no posts matched your criteria.</p>
<br class="clear-margins" />
</div>
<div class="post-foot"></div>
<?php }
} else { ?>
<div class="post-head"></div>
<div class="post">
<p>Sorry, no posts matched your criteria.</p>
<br class="clear-margins" />
</div>
<div class="post-foot"></div>
<?php } ?>
?>
</div>
<?php include(TEMPLATEPATH . '/sidebar.php') ?>