ThemeShaper Forums » Thematic

[closed]

Remove author vcard for only one category

(4 posts)
  • Started 6 years ago by schmeee
  • Latest reply from schmeee
  • This topic is not resolved
  1. As it says in the topic title; I'd like to yank the author vcard for one category of postings. Can someone give me the appropriate php test condition to evaluate a category name before executing

    function remove_postheader_postmeta()

    in functions.php? tyvm

    Posted 6 years ago #
  2. OK, I dug into the wp documentation on conditionals, and I crafted this function:

    // ---------- Remove author info on Testimonial posts
    function childtheme_remove_author() {
    if (in_category('Testimonials')) {
    /* bye vcard, b/c no output specified - blank return */
    }
    }
    add_filter('thematic_postheader_postmeta', 'childtheme_remove_author');
    // ---------- End Remove author info on Testimonial posts

    ...which still isn't working -- it's removing the vcard from ALL posts, not just 'Testimonial' category posts. Any thoughts anyone?

    Posted 6 years ago #
  3. you could either filter this function or the thematic_postmeta_authorlink function. both would probably get you to the same place. and you're spot on w/ your conditionals (as long as it matches the one in your wordpress)

    the problem is that you are not returning the value of $postmeta for anything that ISN'T in your conditional, hence overwriting it all w/ a blank, instead of maintaining the defaults.

    this is how to properly set up a filter that preserves some of the original values

    function childtheme_remove_author($postmeta) {
    if (in_category('Testimonials')) {
        $postmeta = ''; /* bye vcard, b/c no output specified - blank return */
    }
    return $postmeta;
    }
    add_filter('thematic_postheader_postmeta', 'childtheme_remove_author');
    Posted 6 years ago #
  4. Thanks Helga - you're the knees! :Benjamin

    Posted 6 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.