WordPress.org

Ready to get started?Download WordPress

Forums

Variable Sidebar Content Problem (2 posts)

  1. DANG_BLUE
    Member
    Posted 8 years ago #

    Hi,
    I've read Variable Sidebar Content Example in http://codex.wordpress.org/Conditional_Tags anh try to follow it. So I wrote these code in sidebar.php:

    <?php
    if (is_single())
    {
    echo 'This is Single!';
    }
    elseif (is_home())
    {
    echo 'This is home!';
    }
    elseif (is_category())
    {
    echo 'This is category!';
    }
    else
    {
    echo 'This is not single!';
    }
    ?>

    Then, when I was in home page, it showed "This is Home" (correct), But when I viewed catagory page, it showed "This is Home" (incorrect) and when I viewed single post, it still showed "This is Home" (incorrect).

    What's the problem? And how to solve this?

  2. DANG_BLUE
    Member
    Posted 8 years ago #

    no one wants to help me?
    What's wrong with my post?

Topic Closed

This topic has been closed to new replies.

About this Topic