Hello, I know the title of this pose sounds a little confusing, was wondering if any of you have seen a wordpress theme that displays specific sidebars for specific pages/posts. For example, the home/index page would display a specific sidebar, the Products page would display another specific sidebar. Ideally this would be accomplished using widgets and could be used for either posts/pages. Basically I need the ability to define the sidebars that appear per page. I would really like to see a theme that does this and then I can build on that. Do you sort of get what I'm trying to find here?
This will be something you would need to edit in your theme yourself, it's not a feature that a designer would really add to a theme unless it was for a custom client. If you google something like 'dynamic wordrpess sidebar' you will find lots of tutorials on covering this its not hard to implement, you only need a very basic knowledge of php. what you will need to edit is the sidebar.php file and replace either the widget code or html code to something like <?php if (is_front_page()) { include(TEMPLATEPATH."/sidebar_children/sidebar_search.php") ; include(TEMPLATEPATH."/sidebar_children/sidebar_125.php") ; } elseif (is_page(array('about','contact','rss-2','faq','site-sponsors','login-page','submit-a-review','advertise','sitemap'))) { include(TEMPLATEPATH."/sidebar_children/sidebar_search.php") ; } elseif (is_page()) { include(TEMPLATEPATH."/sidebar_children/sidebar_about.php") ; } else { include(TEMPLATEPATH."/sidebar_children/sidebar_rss.php") ; } ?> but like i say google is your friend here, lots of tutorials on this on the interweb hope that helps some
Actually I found a very simple fix and I'm feel kinda stupid for not realizing it. Basically you just need to find where in the page,post,index,etc. the sidebar is called upon, eg <?php include (TEMPLATEPATH . '/sidebar.php'); ?> or the <?php get_sidebar(); ?> Code (markup): And change the code to: <?php $sidebar = get_post_meta($post->ID, "sidebar", true); include ($sidebar); ?> Code (markup): This will allow you to create a custom field in any page/post/index that references a specific sidebar php page. I used this for a left and right sidebar and created individual left/right sidebar files for all pages/posts on a site. A really neat way to fully customize it. I suppose for added functionality you can just create a custom widget setting for each page/sidebar but I don't need that right now, maybe in the future, lol. The above is working in the latest 2.8.4 WordPress version