Written: April 27, 2010

Custom Sidebars in WordPress

Tualatin Farmers Market has a WordPress site the uses a sidebar for searching, hours and sponsors:

This week they asked if the page for Concerts could be changed so that it didn’t show the sponsors:

I remembered that our theme used a file called sidebar.php and then I added a statement to check for the page name and then alter what posts should be searched using query_posts:

The “if” statement uses: is_page(“Concerts”)

If this page is for Concerts then use: category_name=sidebar_no_sponsors

Other pages use a category_name=sidebar

The client can now login to WordPress and update how the sidebar should look:

The advantage of using this approach is that the client can just use the WYSIWYG editor in WordPress to update how the two different versions of the sidebar should look.

Tags: ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog Tags

Recent Posts

Blog Directory & Business Pages at OnToplist.com