ThemeShaper Forums » Thematic

is_page/is_single question in functions.php

(2 posts)
  • Started 3 years ago by walkingpaper
  • Latest reply from Chris
  • This topic is resolved
  1. I'm catching on, but evidently not too sharp with php or conditional statements I guess.

    Can anyone see why I'm only getting a link to the comments in the headers on the front page of my site, and *not* when I'm viewing an individual post?

    TIA,

    // Custom post header
    function childtheme_postheader() {
        global $post;
        if (is_page()) { ?>
           <h1 class="entry-title"><?php the_title(); ?></h1>
        <?php } elseif (is_404()) { ?>
            <h1 class="entry-title">Yikes! Not Found</h1>
        <?php } elseif (is_single()) { ?>
        <!-- <h1 class="entry-title"><?php the_title(); ?></h1> -->
    		<h2 class="entry-title"><a>" title="<?php printf(__('Permalink to %s', 'thematic'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h2>
    		<div class="entry-meta">
    			<span class="entry-date"><abbr class="published" title="<?php get_the_time('Y-m-d\TH:i:sO'); ?>"><?php the_time('F jS, Y') ?></abbr> - <span class="comments-link"><?php comments_popup_link(__('comment', 'thematic'), __('1 comment', 'thematic'), __('% comments', 'thematic')) ?></span></span>
    		</div><!-- .entry-meta -->
    
      <?php } else { ?> 
    
    		<h2 class="entry-title"><a>" title="<?php printf(__('Permalink to %s', 'thematic'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h2>
    		<div class="entry-meta">
    			<span class="entry-date"><abbr class="published" title="<?php get_the_time('Y-m-d\TH:i:sO'); ?>"><?php the_time('F jS Y') ?></abbr> - <span class="comments-link"><?php comments_popup_link(__('comment', 'thematic'), __('1 comment', 'thematic'), __('% comments', 'thematic')) ?></span></span>
    
    		</div><!-- .entry-meta -->
    		<?php if ($post->post_type == 'post') { // Hide entry meta on searches ?>
    
    		<?php } ?>
        <?php }
    }
    add_filter ('thematic_postheader', 'childtheme_postheader');

    (Post edited by Chris to get a styled code)

    Posted 3 years ago #
  2. Hey,

    it won't work on is_single() and on is_page() .. details here: 1 Description

    Take a look into hooks-filters.php, use get_comments_number() and try to rebuild the link like in the original thematic_postfooter() function.

    Cheers,

    Chris

    Posted 3 years ago #

RSS feed for this topic

Reply

You must log in to post.