ThemeShaper Forums » Thematic

[closed]

Need help with setting up conditional filter

(5 posts)
  • Started 10 years ago by erikvlie
  • Latest reply from erikvlie
  • This topic is resolved
  1. Disclaimer: I am a lousy programmer and most of the time I don't fully understand what I'm doing, although I'm really good at copying examples and doing something useful with these for my site.

    This time around, however, I need help. I want to get rid of postmeta and postfooter only on home page and archive pages, and only show them on single post pages.

    Here's what I have tried, but this gets rid of the postmeta on all pages:

    //Remove meta above post
    function childtheme_postheader_postmeta() {
    if (is_single()) {
    }
    }
    add_filter('thematic_postheader_postmeta','childtheme_postheader_postmeta');

    Hope someone is willing to help.

    Posted 10 years ago #
  2. I have changed it because I think there's nothing to show in-between the conditionals, but still no luck:

    function childtheme_postheader_postmeta() {
    if (is_single()) {
    $postmeta = '<div class="entry-meta">';
    $postmeta .= thematic_postmeta_authorlink();
    $postmeta .= '<span class="meta-sep meta-sep-entry-date"> | </span>';
    $postmeta .= thematic_postmeta_entrydate();
    
    $postmeta .= thematic_postmeta_editlink();
    
    $postmeta .= "</div><!-- .entry-meta -->\n";
    }
    return apply_filters('thematic_postheader_postmeta',$postmeta);
    }
    add_filter('thematic_postheader_postmeta','childtheme_postheader_postmeta');
    Posted 10 years ago #
  3. Anyone? Can anyone help me with this, please?

    Posted 10 years ago #
  4. What does one have to do to get an answer to one's problems on this forum? This is the second time I ask a question --after having searched these forums and those at WordPress to find an answer-- and I could just as well be twittering about it. Nobody seems to find my problem serious enough (?).

    I can assure anyone who sees this post --if anyone sees this post at all-- that to a non-programmer like myself, the above is a real problem, and although I'm willing to learn, I can't solve this on my own.

    Meanwhile I changed it again and initially thought it worked until I fired up one of my subdomains (I am using WordPress Mu) --and nothing got served beyond the header section. So what I did and how I changed it didn't help.

    And if anyone actually takes a peek at this question, and for what it is worth: I also tried one of the "solutions" that I found on WordPress forums taught by one self-proclaimed WordPress coder, and the result was identical: nothing served beyond the header section. Which makes me think I'm not the only one having difficulties to grasp WordPress code --I might be one of the few who are honest enough to admit it.

    Posted 10 years ago #
  5. I finally got around solving this for the postmeta part.

    //Remove the metadata from above post on homepage, etc
    function childtheme_postheader() {
        global $post; 
    
        if (is_page() || is_404() || is_home()) { ?>
          <h2 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s', 'thematic'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h2>
      <?php } else { ?>
        <h1 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s', 'thematic'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h1>
    				<?php if ($post->post_type == 'post') { ?>
    		<div class="entry-meta">
              	<span class="author vcard"><?php _e('By ', 'thematic') ?><a class="url fn n" href="<?php get_author_link(true, $authordata->ID, $authordata->user_nicename); ?>" title="<?php __('View all posts by ', 'thematic') . the_author(); ?>"><?php the_author() ?></a></span>
    			<span class="meta-sep"> | </span>
    			<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>
    		</div><!-- .entry-meta -->
    		<?php } ?>
        <?php }
    }
    add_filter ('thematic_postheader', 'childtheme_postheader');
    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.