Support » Fixing WordPress » Sidebar menu displaying only on one page, how to ?

  • Dears,

    everything’s in the title.
    I want to have different sidebar custom menu for each page … now if I put a sidebar menu it appear in all pages of my website
    I’m using the Esplanade theme and can’t show my website at the moment cause working localy.

    thanx

Viewing 1 replies (of 1 total)
  • I do not know Esplanade theme but I guess you could create different sidebar templates like sidebar-1.php sidebar-2.php … and then edit your main template replacing the code
    <?php get_sidebar(); ?>
    with

    <?php get_sidebar( $name );
    if ( is_page( 'page-1' ) ) :
      get_sidebar('sidebar-1');
    elseif ( is_page( 'page-2' ) ) :
      get_sidebar('sidebar-2');
    else
      get_sidebar();
    endif
    ?>

    If you have subpages that share the same sidebar then you should use ‘tree’ + ID number

    if ( is_tree( 'xx' ) ) ://where xx is the parent page ID
      get_sidebar('sidebar-1');

Viewing 1 replies (of 1 total)
  • The topic ‘Sidebar menu displaying only on one page, how to ?’ is closed to new replies.