Support » Themes and Templates » Linking sidebar content to categories

  • I have a wordpress theme which uses three columns. The center column is used for new posts. Posts are placed in different categories, which, on my site, stand for different writers. I would like for the right sidebar to display a short biography and picture of the category (writer) when people clicked on a post, but this short bio should not show on the homepage of the site. I think that for this to happen there should be a piece of dynamic code in the sidebar that links the category people are reading in to the right bio. Does anybody know how to do that? Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You could do this using the is_single conditional tag then nest an if_category within that (assuming that each author is using their own category)

    Thanks for the hint. What would the code look like? I tried using this:

    <?php if ( is_category(‘3’) (‘This guy sucks at php’) ) : else : ?>
    <?php endif; ?>

    but it didn’t work. Do you know what I did wrong?

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Try “in_category” instead of “is_category”.

    Thanks, that did the trick!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Linking sidebar content to categories’ is closed to new replies.