WordPress.org

Ready to get started?Download WordPress

Forums

Linking sidebar content to categories (5 posts)

  1. janvantienen
    Member
    Posted 6 years ago #

    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.

  2. dcroe05
    Member
    Posted 6 years ago #

    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)

  3. janvantienen
    Member
    Posted 6 years ago #

    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?

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Try "in_category" instead of "is_category".

  5. janvantienen
    Member
    Posted 6 years ago #

    Thanks, that did the trick!

Topic Closed

This topic has been closed to new replies.

About this Topic