Page/Post Option – Left, Right or No Sidebar
Posted on October 26, 2009 and last modified on October 27th, 2009.
There are several means of changing the sidebar content within this theme and many of them are discussed at length here and here. However, the purpose of this post is to explain the positioning of the sidebar and which sidebar to include on any given page or post.
The names of the varying sidebar are as follows:
- sidebar.php
- sidebar_all.php
- sidebar_gallery.php
- sidebar_left.php
- sidebar_short.php
Each one of these is slightly different and they are called from within the page templates on the second to last line of code. Here is an example of the gallery page [page_gallery.php] calling the sidebar-gallery.php
<?php include('sidebar-gallery.php'); ?>
A note here for those who may make some more sidebars of their own. I found that using underscores caused me problems later when I used the the next method to call different sidebars for different posts so make sure you use a hyphen as opposed to an underscore, i.e. sidebar-gallery and NOT sidebar_gallery.
In posts, by default the sidebar will always be sidebar.php which includes all of the sidebar elements. However you can change which sidebar displays by adding a simple custom field aptly named ‘sidebar‘ and then using the name of the sidebar as the value. For example, to call the same sidebar within a post that is used on the Gallery page, all you need to do is add sidebar to the custom field name and then add ‘gallery‘ to the value. Update and save and it’s all done.
It is done on this post just to show you the result.










[...] This briefly describes the manner in which the sidebar elements work, now let’s take a look at how the sidebars within each page can be adjusted to suit each page’s individual style. Go look now… [...]
[...] WIDGET READY in TWO SIDEBARS – RIGHT MENU and FOOTER [...]