Add Background Color To Single Page Sidebar On Default WordPress Theme

Wow is that title long enough for you? I searched for the answer to this for hours and what seems like second nature to the geeks actually drove me nuts! I explain how to add the sidebar to a single page in this related post, Adding The Sidebar To The WordPress Page Or Single Post Template. In that I explain how to add the sidebar to the single post page of the . What is missing from that are instructions for getting the single post page to show the light gray background on the sidebar that is shown on the main index page.

So here we are going to further to get everything looking uniform throughout the entire blog using the .

First you need to be able to either edit the themes files through the or edit them from your hosting accounts control panel. To edit the themes files in the dashboard they need the proper file permissions set, I explain how to change the file permissions in this related post: Adding The Sidebar To The WordPress Page Or Single Post Template.

From the WordPress dashboard go to Presentation, Theme Editor. Click on Header on the right side and the header.php file will be visible in the editor. Warning if you are not experienced with editing these files copy all the text in here and paste it into Wordpad or Notepad and save a copy of it on your computer.

The WordPress default theme was written to not show the sidebar on the single post page. Because of that it specifies one background image for the main index that shows the gray background in the sidebar. And another image for the single post page with no background in the sidebar area. The version of the default theme you have determines what image background to use. But don’t worry you will see what image to use right within your header.php file.

With the header.php file open scroll down and look for the code that looks like this for older versions of the theme:

#page { background: url(”<?php bloginfo(’stylesheet_directory’); ?>/images/kubrickbg.jpg“) repeat-y top; border: none; }
<?php } else { // No sidebar ?>
#page { background: url(”<?php bloginfo(’stylesheet_directory’); ?>/images/kubrickbgwide.jpg“) repeat-y top; border: none; }
<?php } ?>

</style>

Or like this for newer versions:

#page { background: url(”<?php bloginfo(’stylesheet_directory’);

?>/images/kubrickbg-<?php bloginfo(’text_direction’); ?>.jpg”) repeat-y top; border:

none; }
<?php } else { // No sidebar ?>
#page { background: url(”<?php bloginfo(’stylesheet_directory’);

?>/images/kubrickbgwide.jpg”) repeat-y top; border: none; }
<?php } ?>

</style>

The first instance of the red text is specifying the background image to use on the a page that has no sidebar, again it depends on what version of the theme you are using as to what you are going to see in your header.php file. Now all you need to do is copy the code from the top and replace it with the code on the bottom like this:

#page { background: url(”<?php bloginfo(’stylesheet_directory’); ?>/images/kubrickbg.jpg“) repeat-y top; border: none; }
<?php } else { // No sidebar ?>
#page { background: url(”<?php bloginfo(’stylesheet_directory’); ?>/images/kubrickbg.jpg“) repeat-y top; border: none; }
<?php } ?>

</style>

Or like this for newer versions:

#page { background: url(”<?php bloginfo(’stylesheet_directory’);

?>/images/kubrickbg-<?php bloginfo(’text_direction’); ?>.jpg”) repeat-y top; border:

none; }
<?php } else { // No sidebar ?>
#page { background: url(”<?php bloginfo(’stylesheet_directory’);

?>/images/kubrickbg-<?php bloginfo(’text_direction’); ?>.jpg”) repeat-y top; border: none; }
<?php } ?>

</style>

Click Update File and check out your blog to make sure you did it correctly. If your is all messed up just paste the code back in from the backup file you made. And don’t blame me if you didn’t make a backup of the files, I warned you twice!



Share This AddThis Social Bookmark Button Sphinn Gregarious FeedFlare

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!


Tagged with , ,


Related Posts





5 Responses to “Add Background Color To Single Page Sidebar On Default WordPress Theme”

  1. […] Add Background Color To Single Page Sidebar On Default WordPress Theme Customize WordPress sidebar WordPress WordPress Guide Digg It Share This Gregarious FeedFlare Sphere: Related ContentIf you’re new here, you may want to subscribe to my RSS feed. Thanks for visiting! –> […]

  2. […] The final step in this WordPress guide can be found on my other blog here: Add Background Color To Single Page Sidebar On Default WordPress Theme […]

  3. Add Background Color To Single Page Sidebar On Default WordPress Theme…

    The WordPress default theme was written to not show the sidebar on the single post page. Because of that it specifies one background image for the main index that shows the gray background in the sidebar. This WordPress guide shows how to add the backg…

  4. I am trying to give background color to the title of link but it is not applying.Can you help me for that.

  5. Thank you! This article and “Adding The Sidebar To The WordPress Page Or Single Post Template.” very help me for tuning my default WP theme.

Discussion Area - Leave a Comment

If you have a question about your blog please leave a link to it. Please don't ask questions like "Why don't my blog work right?" and expect an answer.

Two links or less are welcome, any more and your comment will be spammed! Nofollow has been disabled, all comments are moderated and will not appear until approved. Please submit only once.



XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Or just copy the example below and change your details.
Example - <a href="http://www.YourSite.com">Title Of Site</a>







Close
E-mail It