WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] D (5 posts)

  1. Mario Malcangi
    Member
    Posted 1 year ago #

    i apply this code instead <?php get_sidebar ?> in the single.php:

    <?php if (is_category('test')) {
    get_sidebar('courses'); //sidebar-courses.php
    } else {
    get_sidebar();
    }; ?>

    display always default sidebar

    please help me

  2. riversatile
    Member
    Posted 1 year ago #

    Hi,

    You have to change the sidebar name that is called.

  3. phe.le
    Member
    Posted 1 year ago #

    Open sidebar-courses.php and change dynamic_sidebar() to your registered courses sidebar. For example: dynamic_sidebar('Courses Sidebar);

    Otherwise check out this great plugin http://wordpress.org/extend/plugins/widget-logic/

  4. alchymyth
    Forum Moderator
    Posted 1 year ago #

    is_category() only works for category archive psges;

    in a single.php, try to use:

    in_category()

  5. Mario Malcangi
    Member
    Posted 1 year ago #

    thanks alchymyth... it's work with in_category
    :)

Topic Closed

This topic has been closed to new replies.

About this Topic