The Teen Forums - Chat and more » Blogging Tips, Tricks & Advice » Wordpress Blog Tips

Customize Your Wordpress Sidebar

(1 post)
  • Started 5 months ago by admin
  1. admin

    The Boss
    Joined: Oct '07

    Is your sidebar static and boring? Does it make you blind when looking at the same thing page after page after page? If you agree with wpdesigner.com and think that "static sidebars suck*" then you must read this post.
    Navigation
    Remember the main purpose of the sidebar has always been to provide navigation to your visitors, so, if your not using widgets, using wp_list_cats(); and wp_list_pages(); is a must.
    Using Conditional Tags
    By using conditional tags, you can take your sidebar from boring and static, to dynamic and eye catching. If you have never used conditional tags before, by the end of this article you will love them.

    Conditional tags allow you to change what is displayed in a certain area based on what the current page is, for e.g. if you use is_home() you can have a certain piece of text that is only displayed when viewing the homepage. Or if you used is_single() you could display some information about the current post.

    There are a whole list of conditional tags that are available to use here*.
    Recently Posted
    Displaying the list of recently posted posts/articles is a good way of keep the sidebar fresh, i would recommend displaying the last 5 or so, or if you use the WP-PostRatings plugin that i mentioned on my list of useful plugins then u could also display a list of the top rated posts. (like i currently do)
    Different Sidebars For Different Pages
    Currently i have a main sidebar that displays on most pages of the blog, however when you view a single blog post i have it set to display its own unique sidebar (have a look at the sidebar currently in use and compare it to the one on the homepage).

    Currently to display sidebars, you use the following code;

    get_sidebar();

    If you want to for e.g. have a different sidebar on your single post then you, make a copy of your sidebar.php and name the copy sidebar-single.php, then you would edit single.php, find the above code and replace it with

    include ('sidebar-single.php');

    You can now edit sidebar-single and make it display whatever you want display on your single posts page.
    Other Common Stuff
    Other stuff that could be placed in the sidebar is meta data, links RSS feeds.

    For more information about any of the above i would recommend that you have a search through this page*.
    Example Sidebars
    Heres a little extra for you all, here is the current codes that i use in my sidebars.

    Here is the code currently used in my sidebar.php and here is the code currently used in sidebar-single.php

    Thanks to the following pages for helping me put together this post;

    Posted 5 months ago #

RSS feed for this topic

Reply

You must log in to post.