View Single Post
Old 2007-05-08, 03:44 AM   #1
Ms Naughty
old enough to be Grandma Scrotum
 
Ms Naughty's Avatar
 
Join Date: Aug 2003
Location: Australia
Posts: 1,408
Send a message via ICQ to Ms Naughty
Creating a post-specific sidebar

Thanks again to Walrus, I've discovered another way to tweak my blog so I thought I'd make a post about it for other lost souls such as myself.

You can code Wordpress so that the sidebar shows different things according to whether you're looking at a post or at the main page.

The code is:

Code:
<?php /* If this is the home page */ if (is_home()) { ?>
    <?php include (TEMPLATEPATH . '/nameofinclude1.php'); ?>
    <?php } ?>
	<?php /* If this is the post page */ if (is_single()) { ?>
    <?php include (TEMPLATEPATH . '/nameofinclude2.php'); ?>
You need to make individual includes for each thing you need to be different.

Say you want to link to a gallery pics in your sidebar but want one thing on the post page and something different on the main page. You'd create a separate php file with just the pic in it. You'd upload it into your theme directory and you'd change the name in the above code to whatever the include is called.

I don't know if this post will help anybody but I was so proud of working it out I thought I'd share.

I think I'm starting to get the hang of this
__________________
Promote Bright Desire
Ms Naughty is offline   Reply With Quote