Different Sidebar on Pages
-
Hi all,
Am trying to make a custom wp type site for a friend and would like to use a sidebar that doesn’t include the blog categories etc on the pages that I create with wordpress.
Is this possible at all? If so could I get some direction here please?
Thank you in advance.
-
You can register as many sidebars as you would like and then call them by name in the theme files:
<?php get_sidebar('main_sidebar'); ?>So, many themes will have a ‘main sidebar’ that is on all the blog pages and then a ‘page sidebar’ that gets called in the page.php file and is only displayed on ‘pages’
OK, so I registered the following code in functions.php in my theme directory:
// Area 7, located on all Pages. Empty by default. register_sidebar( array( 'id' => 'page-sidebar', 'name' => __( 'Page Sidebar' ), 'description' => __( 'Sidebar for all user created pages.' ), 'before_widget' => '<li id="%1$s" class="widget %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) );and called it in page.php from my theme folder thus:
<?php get_sidebar('page-sidebar'); ?>The sidebar appears in admin under widgets but even if I use the area the actual page still shows the usual blog sidebar.
did you make the sidebar?
you can probably copy sidebar.php and rename it to sidebar-page-sidebar.php
Hi!
something even more easier, WIDGET LOGIC plugin.
This plugin allows you to pick a diferent sidebar widget for each page of your blog independantly.
You will have to enter a shortcode on each on the widget you will be implementing in your sidebar to define on which page(s) the sidebarwidget will appear.have fun!
Oh my.. how very useful! 🙂
Thanks people.
Really enjoying playing with WordPress!
The sidebar thing however has me wondering if there is a way to have different pages show different sidebars? So if I made two different pages in WordPress one called A the other B, A would display sidebar 1 and B would display sidebar 2.
Just wondering 🙂
The topic ‘Different Sidebar on Pages’ is closed to new replies.