Wordpress and Webdesign Forum go41 » WordPress Code Snippets

  1. Hi Joern,

    I think I've seen this elsewhere before but I want to add a block of text to every post that falls in our "blog" category (http://www.iamstaggered.com/category/blogs) explaining how to follow/subscribe to a particular writer if readers want to.

    Is there an easy way of doing it?

    Cheers,

    Andrew.

    Posted 1 year ago #
  2. If you use just one single.php for all singles and you want to display something on a single view only in one category, use the condition 'in_category()', this tests if the current post is assigned to any of the specified categories.
    Anywhere in single.php you can add this:

    <?php if ( in_category( 'blogs' )) { ?>
    here your code or explanation
    <?php } ?>

    try this code just as it is in single.php and look if you find "here your code or explanation" on your blogs category single page, if it works think about what to put in there

    more about in_category here:
    http://codex.wordpress.org/Function_Reference/in_category

    btw: you had problems to post - I found your posts in the spam filter, too many links in there ...

    Posted 1 year ago #
  3. Thanks ever so much again Joern!

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in to post.

Join us! or log in (lost password?):