displayblogpost and displaycomicpost now disappear and it's centralized to comicpress_display_post() inside displaypost.php, adjusted post_classes to work properly with it

Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
Philip M. Hofer (Frumph) 2009-12-24 15:01:47 -08:00
parent d75c46345b
commit 0357068abe
17 changed files with 83 additions and 71 deletions

View File

@ -1,14 +1,14 @@
<?php get_header(); ?>
<?php include(get_template_directory() . '/layout-head.php'); ?>
<div class="<?php comicpress_post_class(); ?>">
<div class="post-page-head"></div>
<div class="post-page">
<div class="post post-404">
<div class="post-head"></div>
<div class="post-content">
<h2 class="pagetitle"><?php _e('Page Not Found','comicpress'); ?></h2>
<p><a href="<?php bloginfo('wpurl') ?>"><?php _e('Click here to return to the home page','comicpress'); ?></a> <?php _e('or try a search:','comicpress'); ?></p>
<p><?php the_widget('WP_Widget_Search'); ?></p>
</div>
<div class="post-page-foot"></div>
<div class="post-foot"></div>
</div>
<?php include(get_template_directory() . '/layout-foot.php'); ?>

View File

@ -70,7 +70,7 @@ $month['12'] = array('month' => __('December','comicpress'), 'days' => '31');
<?php while (have_posts()) : the_post() ?>
<?php comicpress_display_page_post(); ?>
<?php comicpress_display_post(); ?>
<?php endwhile; ?>

View File

@ -9,7 +9,7 @@ Template Name: This Month of Comics
<?php
if (have_posts()) {
while (have_posts()) : the_post();
comicpress_display_page_post();
comicpress_display_post();
endwhile;
}

View File

@ -9,7 +9,7 @@ Template Name: Comic Storyline with Thumbs
<?php
if (have_posts()) {
while (have_posts()) : the_post();
comicpress_display_page_post();
comicpress_display_post();
endwhile;
}
?>

View File

@ -9,7 +9,7 @@ Template Name: Comic Storyline Archive
<?php
if (have_posts()) {
while (have_posts()) : the_post();
comicpress_display_page_post();
comicpress_display_post();
endwhile;
}
?>

View File

@ -20,7 +20,7 @@ if (empty($archive_year) || $archive_year == '') $archive_year = date('Y');
<?php
if (have_posts()) {
while (have_posts()) : the_post();
comicpress_display_page_post();
comicpress_display_post();
endwhile;
}
?>

View File

@ -9,7 +9,7 @@ Template Name: Comic Archive
<?php
if (have_posts()) {
while (have_posts()) : the_post();
comicpress_display_page_post();
comicpress_display_post();
endwhile;
}
?>

View File

@ -9,7 +9,7 @@ Template Name: Archives
<?php
if (have_posts()) {
while (have_posts()) : the_post();
comicpress_display_page_post();
comicpress_display_post();
endwhile;
}
?>

View File

@ -91,7 +91,9 @@ function comicpress_body_class($classes = '') {
return $classes;
}
function comicpress_post_class($class = '') {
add_filter('post_class','comicpress_post_class');
function comicpress_post_class($classes = '') {
global $post;
static $post_alt;
@ -101,6 +103,12 @@ function comicpress_post_class($class = '') {
/* Microformats. */
$classes[] = 'uentry';
/* if a comic category */
if (in_comic_category()) $classes[] = 'comicpost';
if (is_page()) $classes[] = 'pagepost';
if (!in_comic_category() && !is_page()) $classes[] = 'blogpost';
/* Post alt class. */
$classes[] = 'postonpage-' . ++$post_alt;
@ -129,10 +137,7 @@ function comicpress_post_class($class = '') {
$classes = array_merge( $classes, $class );
endif;
/* Join all the classes into one string and echo them. */
$class = join( ' ', $classes );
echo apply_filters( 'comicpress_post_class', $class );
return $classes;
}
add_filter('comment_class','comicpress_comment_class');

View File

@ -35,7 +35,7 @@ function display_blog_post() {
<?php comicpress_display_post_tags(); ?>
<?php comicpress_display_comment_link(); ?>
<div class="clear"></div>
<?php if ($comicpress_options['enable_related_posts']) echo ComicPressRelatedPosts::display_related_posts(); ?>
<?php comicpress_display_related_posts(); ?>
</div>
</div>
<div class="post-foot"></div>

View File

@ -45,8 +45,8 @@ function display_comic_post($frontpage = 0) {
<div class="post-comic-extras">
<?php comicpress_display_post_tags(); ?>
<?php comicpress_display_comment_link(); ?>
<div class="clear"></div>
<?php if ($comicpress_options['enable_related_comics']) echo ComicPressRelatedPosts::display_related_comics(); ?>
<div class="clear"></div>
<?php comicpress_display_related_posts(); ?>
</div>
</div>
<div class="post-comic-foot"></div>

View File

@ -26,7 +26,7 @@ function comicpress_display_post_thumbnail() {
function comicpress_display_author_gravatar() {
global $post, $wp_query, $comicpress_options;
if ((!in_comic_category() && $comicpress_options['enable_post_author_gravatar']) || (in_comic_category() && $comicpress_options['enable_comic_post_author_gravatar']) && !is_page()) {
if (((!in_comic_category() && $comicpress_options['enable_post_author_gravatar']) || (in_comic_category() && $comicpress_options['enable_comic_post_author_gravatar'])) && !is_page()) {
$author_get_gravatar = str_replace("alt='", "alt='".get_the_author_meta('display_name')."' title='".get_the_author_meta('display_name'),comicpress_get_avatar(get_the_author_meta('email'), 64));
$author_gravatar = "<div class=\"post-author-gravatar\">".$author_get_gravatar."</div>\r\n";
echo apply_filters('comicpress_display_author_gravatar', $author_gravatar);
@ -68,7 +68,7 @@ function comicpress_display_post_tags() {
}
function comicpress_display_comment_link() {
global $post, $comicpress_option;
global $post;
if ('open' == $post->comment_status) {
if (comicpress_check_child_file('partials/commentlink') == false && !is_single()) {
$post_comment_link = "<div class=\"comment-link\">".get_comment_reply_link('<span class="comment-balloon comment-balloon-empty">&nbsp;</span> '.__('Comment ','comicpress'), '<span class="comment-balloon">1</span> '.__('Comment ','comicpress'), '<span class="comment-balloon">%</span> '.__('Comments ','comicpress'))."</div>\r\n";
@ -77,6 +77,16 @@ function comicpress_display_comment_link() {
}
}
function comicpress_display_related_posts() {
global $post, $comicpress_options;
if (in_comic_category() && $comicpress_options['enable_related_comics']) {
echo ComicPressRelatedPosts::display_related_comics();
}
if (!in_comic_category() && $comicpress_options['enable_related_posts']) {
echo ComicPressRelatedPosts::display_related_posts();
}
}
function comicpress_display_blog_navigation() {
global $post, $wp_query;
if (is_single() && !in_comic_category()) { ?>
@ -90,6 +100,24 @@ function comicpress_display_blog_navigation() {
<?php }
}
function comicpress_display_comic_navigation() {
global $post, $wp_query;
if (!$comicpress_options['disable_default_comic_nav']) {
$first_comic = get_first_comic_permalink();
$last_comic = get_last_comic_permalink();
if (!is_search() && !is_archive() && !is_page() && in_comic_category()) { ?>
<div class="nav">
<?php if ( get_permalink() != $first_comic ) { ?><div class="nav-first"><a href="<?php echo $first_comic ?>"><?php _e('&lsaquo;&lsaquo; First','comicpress'); ?></a></div><?php } ?>
<div class="nav-previous"><?php $temp_query = $wp_query->is_single; $wp_query->is_single = true; previous_comic_link('%link', __('&lsaquo; Previous','comicpress')); $wp_query->is_single = $temp_query;$temp_query = null; ?></div>
<div class="nav-next"><?php next_comic_link('%link', __('Next &rsaquo;','comicpress')) ?></div>
<?php if ( get_permalink() != $last_comic ) { ?><div class="nav-last"><a href="<?php echo $last_comic ?>"><?php _e('Last &rsaquo;&rsaquo;','comicpress'); ?></a></div><?php } ?>
</div>
<br class="clear-margins" />
<?php }
}
}
function comicpress_display_the_content() {
global $post, $wp_query, $comicpress_options;
if (is_archive() || is_search()) {
@ -115,10 +143,12 @@ function comicpress_display_post() {
global $post, $wp_query; ?>
<div <?php post_class(); ?>>
<?php comicpress_display_blog_navigation(); ?>
<?php comicpress_display_comic_navigation(); ?>
<?php comicpress_display_post_thumbnail(); ?>
<div class="post-head"></div>
<div class="post-content">
<div class="post-info">
<?php comicpress_display_author_gravatar(); ?>
<?php if (function_exists('comicpress_show_mood_in_post')) comicpress_show_mood_in_post(); ?>
<div class="post-text">
<?php
@ -126,12 +156,12 @@ function comicpress_display_post() {
if (!is_page()) {
comicpress_display_post_author();
comicpress_display_post_category();
if (function_exists('the_ratings')) { the_ratings(); }
edit_post_link(__('Edit Post','comicpress'), ' [ ', ' ] ');
}
?>
if (function_exists('the_ratings')) { the_ratings(); }
if (!is_archive() && !is_search()) { ?>
<small><?php edit_post_link(__('Edit Post','comicpress'), ' [ ', ' ] '); ?></small>
<?php }
} ?>
</div>
<?php comicpress_display_author_gravatar(); ?>
</div>
<div class="clear"></div>
<div class="entry">
@ -144,32 +174,13 @@ function comicpress_display_post() {
<?php comicpress_display_post_tags(); ?>
<?php comicpress_display_comment_link(); ?>
<div class="clear"></div>
<?php if ($comicpress_options['enable_related_posts']) echo ComicPressRelatedPosts::display_related_posts(); ?>
<?php comicpress_display_related_posts(); ?>
</div>
<?php if (is_page()) { edit_post_link(__('Edit this page.','comicpress'), '<p>', '</p>'); } ?>
<div class="post-foot"></div>
</div>
<?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 comicpress_display_post_title(); ?>
<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

@ -8,7 +8,7 @@
$wp_query->is_archive = false;
if (have_posts()) {
while (have_posts()) : the_post();
display_comic_post();
comicpress_display_post();
comments_template();
endwhile;
}
@ -38,7 +38,7 @@
<div class="blogindex">
<?php while (have_posts()) : the_post();
display_blog_post();
comicpress_display_post();
endwhile; ?>
</div>

View File

@ -9,7 +9,7 @@ Template Name: Links
<?php
if (have_posts()) {
while (have_posts()) : the_post();
comicpress_display_page_post();
comicpress_display_post();
endwhile;
}
?>

View File

@ -3,7 +3,7 @@
<?php while (have_posts()) : the_post() ?>
<?php comicpress_display_page_post(); ?>
<?php comicpress_display_post(); ?>
<?php endwhile; ?>

View File

@ -5,7 +5,7 @@
if (have_posts()) : while (have_posts()) : the_post();
if (in_comic_category()) {
if (!$comicpress_options['disable_comic_blog_single']) {
display_comic_post();
comicpress_display_post();
$cur_date = mysql2date('Y-m-j', $post->post_date);
$next_comic = get_next_comic();
$next_comic = (array)$next_comic;
@ -13,7 +13,7 @@ if (have_posts()) : while (have_posts()) : the_post();
$blog_query = 'showposts='.$blog_postcount.'&order=asc&cat=-'.exclude_comic_categories();
}
} else {
display_blog_post();
comicpress_display_post();
}
endwhile;
?>
@ -40,7 +40,7 @@ if (have_posts()) : while (have_posts()) : the_post();
<div class="blogindex">
<?php while (have_posts()) : the_post();
display_blog_post();
comicpress_display_post();
endwhile; ?>
</div>
@ -66,7 +66,7 @@ if (have_posts()) : while (have_posts()) : the_post();
add_filter('posts_where', 'filter_where');
$posts = query_posts($blog_query);
if (have_posts()) { while (have_posts()) : the_post();
display_blog_post();
comicpress_display_post();
endwhile; }
}
$post = $temppost; $wp_query = $temp_query; $temppost = null; $temp_query = null;

View File

@ -474,33 +474,29 @@ h4, h4 a {
padding: 1%;
}
.post, .post-comic, .post-page {
.post {
clear: both;
text-align: left;
}
.post-page-head {
padding-top: 5px;
}
.post-foot, .post-comic-foot {
.post-foot {
margin-bottom: 40px;
}
.post-image, .post-comic-image, .post-page-image {
.post-image {
}
.post-info, .post-comic-info {
.post-info {
padding-bottom: 5px;
font-size: 12px;
}
.post-text, .post-comic-text {
.post-text {
overflow: hidden;
display: block;
}
.post-author-gravatar, .post-comic-author-gravatar {
.post-author-gravatar {
float: right;
}
@ -509,7 +505,7 @@ h4, h4 a {
margin-right: 2px;
}
.post-calendar-date, .post-comic-calendar-date {
.post-calendar-date {
color: #777;
font-family: 'Georgia' , serif;
font-size: 15px;
@ -518,7 +514,7 @@ h4, h4 a {
margin-right: 3px;
}
.post-calendar-date .calendar-date, .post-comic-calendar-date .calendar-date {
.post-calendar-date .calendar-date {
height: 50px;
width: 45px;
background: url(images/calendar.png) center no-repeat;
@ -532,7 +528,7 @@ h4, h4 a {
}
.post-calendar-date .calendar-date span, .post-comic-calendar-date .calendar-date span {
.post-calendar-date .calendar-date span {
height: 16px;
padding: 1px 0 4px 0;
display: block;
@ -560,17 +556,17 @@ h4, h4 a {
clear: both;
}
.post-tags, .post-comic-tags {
.post-tags {
font-size: 12px;
}
.post .members-only, .post-comic .members-only {
.post .members-only {
border: 1px dotted #000;
background: #fafafa;
padding: 3px;
}
.post .non-member, .post-comic .non-member {
.post .non-member {
border: 1px dotted #000;
background: #fafafa;
padding: 3px;