treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Sidebar in Wordpress .. How?

  • Alright, I am working on a new layout for my personal webpage. I use WordPress for content management. I'd like to include a sidebar with some information, links to social sites like twitter and perhaps a book recommend image (sort of like: http://srobbin.com/).

    An example of the kind of sidebar I'm thinking of is: http://www.thefoxisblack.com/

    What is the best way to do this? In the past, before I used wordpress, I would include the information in the html of the site. I'd like to be able to edit the content in the sidebar via wordpress. Is it possible to create a specific page in wordpress and code the template to have that page displayed on other pages and entries? I searched around for a tutorial on this but haven't found anything. Any help would be great. Thanks!
  • WordPress comes with a feature called widgets which are simple to use to say the least, see the below two links which explain how to use and create them.

    http://codex.wordpress.org/WordPress_Widgets
    http://codex.wordpress.org/Widgetizing_Themes
  • If I want to use the widgets to put content into my sidebar, do I simply inset the following code where I want the widgets to appear?


    <div id="sidebar">
    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar() ) : ?>
    <?php endif; ?>
    </div>


    Is there anything else I'd need to include? Is it necessary to use a sidebar.php file?