Custom Sidebars
-
Ok I have a home page that is id=1 that has no sidebar but a widgeted footer.
I have Pages with a Page template<?php get_sidebar('Page Sidebar'); ?>to call the sidebar in that template
and a template for my blog or new posts page<?php get_sidebar(); ?>which is getting the regular side bar
my sidebar.php is
<?php if ( is_page('6')) { include(TEMPLATEPATH . '/sidebar-blog.php'); } elseif ( is_page('1')) { include(TEMPLATEPATH . ''); } else { include(TEMPLATEPATH . '/sidebar-pages.php'); } ?>so the blog is page 6 home page 1 (page id not order)
functions.php<?php if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => 'Right Sidebar', 'before_widget' => '', 'after_widget' => '', 'before_title' => '<h2>', 'after_title' => '</h2>', )); if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => 'Footer', 'before_widget' => '', 'after_widget' => '', 'before_title' => '<h2>', 'after_title' => '</h2>', )); if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => 'Page Sidebar', 'before_widget' => '', 'after_widget' => '', 'before_title' => '<h2>', 'after_title' => '</h2>', )); >and i can edit all 3 sidebars in widgets admin easy peasey
All sidebars seem to be working AS i want them .. until i change the reading settings and make a static home page of Home .. and hence call my Posts page as the Blog page.
When I do that all of a sudden all pages including Blog have the same regular sidebar on them .. am i doing somethign wrong .. as it works without static home page i thought I had got it right .. but once i make it static .. it stops working .. any help greatly welcome !
-
other people must have come across this … but all the things I have read in the support pages and this forum just seem to be people that didn’t know how to do it .. I feel I have done it right .. as it works until I choose a static home page …
…. anyone .. ?
I use this format to change sidebars.
Use
<?php get_sidebar() ?>on every page.Then inside
sidebar.phphave something like.<?php if (is_home()) { include('home-sidebar.php'); } else { include('normal-sidebar.php'); ?>Within this system you can use all sorts of conditional tags, seems easier to manage to me. http://codex.ww.wp.xz.cn/Conditional_Tags
brilliant
but i have a template page for home called Leader.php which has no side bar. and the rest all get_sidebar as you said.
but it doesn’t seem to want to tell apart my (blog) posts page fro mother pages when i have a static home page made up in the settings. It works fine until that setting is changed (which I have to do as I dont want my blog posts on the front page.
The topic ‘Custom Sidebars’ is closed to new replies.