Support » Fixing WordPress » different sidebar in each category there is a problem

  • hi to wordpreess lovers….

    I make the conditions for the side bar…

    if (is_single() && in_category('5') || is_category(5)) {
        if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar News') );
    
    } elseif (is_single() && in_category('6') || is_category(6)) {
        if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar Articles') );
    
    } elseif (is_single() && in_category('8') || is_category(8) || ($cat->cat_ID=="8")) {
            if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar Poems') );
    
    } else {
    
        if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar') );
    }

    now the problem is there is a post in two categories. every time they take the first category. how we can solve this. like if the post in category 5 and 6 take the 6 not the 5… or is there any solution.

    bec the category 6 is sub category of the 5 and we want the show the sidebar which is to 6 not to 5…

    thank you

  • The topic ‘different sidebar in each category there is a problem’ is closed to new replies.