WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] get_sidebar by checking for the the category …

[Resolved] get_sidebar by checking for the the category …

  • Hi all,

    Sorry for my poor php. Here it comes;

    I like to use a different sidebar for a specific category (and maybe antoher sidebar for another category).

    As I understand its something lige this:

    <?php
    if ( in_category('category-a') ) {
    	<?php get_sidebar('category-a'); ?>;
    } elseif ( in_category('all-other-categorys') ) {
    	<?php get_sidebar('sidebar'); ?>;
    } else {
    
    }
    ?>

    But its not the way to do it …

    Guess its basic php – I gotter learn some day 😉

    thanks

    rasmus

Viewing 1 replies (of 1 total)
  • got it …

    its as simple as this:

    <?php
    if ( in_category('39') ) :
        get_sidebar('two'); //this will include sidebar-two.php
    else :
        get_sidebar();
    endif;
    ?>

    Sorry for sleepy eyes. ;-(

    rasmus

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] get_sidebar by checking for the the category …’ is closed to new replies.
Skip to toolbar