Customizing your WordPress Sidebar

I’ve had some people asking me how did I customize the right sidebar of my blog, from the RSS Feed link at the top till the categories below. I’m writing this article to try to help you achieve something like I did on Paintbits on your WordPress Blog.

Sidebar by Nicholas T.
Before I begin with the tips, let me tell you that all that I’m writing here is not rocket science. All of this is simple CSS, I didn’t read any guide to do it, just looked at the generated WordPress HTML code and applied a bit of CSS to change the look of the sidebar to fit my taste. The CSS used is also very simple, nothing fancy, everything comes in the manual! ;) With that said, let’s start.
RSS Feed Link with a Rollover Image
Making an RSS Feed Link using an Image to create a Rollover effect, just like you can achieve using Javascript is very easy, it only takes a bit of CSS.
I’m using K2 theme with a style made by me so some things might be different if you use another theme. K2 replaces the Widget system with a different system so the code generated for the widgets is slightly different. Using K2, I created a new Text, HTML and PHP Widget (that allows you to write HTML and PHP), positioned it at the top with the following code inside:
<a id="rss_sidelink" href="http://feeds.feedburner.com/Paintbits"
title="Subscribe to my RSS Feed"></a>
As you can see it’s a simple link to the Feed with a CSS ID, in this case rss_sidelink.
Now to achieve the Rollover effect you need an image containing the 2 States. You can see the image I used below as example.

Now to make the Image change we just add a bit of CSS, I’ll show you what I used here on paintbits.
#rss_sidelink
{
height: 60px;
width: 230px;
text-indent: 10000px;
overflow: hidden;
background: url(/wp-content/themes/k2/styles/lumen/images/rss.jpg)
top left no-repeat;
display: block;
}
#rss_sidelink:hover
{
background-position: bottom left;
}
Styling the Sidebar Widgets
With the RSS Feed Image done let’s focus on the other Widgets. I’ll give you one example using the Popular Posts Widget. K2 brings its own Popular Posts Widget, if it isn’t the case with your theme, you can find one easily in WordPress Plugin Directory. Anyway this is just the main idea, you can apply the same styling to the other widgets as their HTML is very similar.
Moving on…
Design a nice Image to serve as header for your Widgets, or simply add a custom text. I went with an image, you can see it below or on my sidebar.

Let’s look at the WordPress HTML generated code (take into consideration that my Widget structure might be slightly different from yours due to the use of K2 in my blog).
<div id="popular" class="widget module module5 WPPP_print_widget">
<ul class='wppp_list'>
<li></li>
<li></li>
<li></li>
</ul>
</div>
The structure of all Widgets using K2 is all fairly simple. They are simple Unordered Lists (UL) with a specific class (in this case wppp_list) with several List Items (li) enclosed in a div (id=”popular” class=”widget module module5 WPPP_print_widget”).
So, to modify it’s appearance we just create some CSS styling this specific classes. The same can be done to the other classes generated in the other Widgets (like the Tag Cloud, Post Categories, etc…).
#popular
{
background: url('http://www.paintbits.com/Imagens/tags_pp.png')
top left no-repeat;
}
#popular .wppp_list
{
padding-top:40px;
}
#popular .wppp_list li
{
border-bottom: 1px dotted #21303b;
{
With this little guide I hope I gave you a fairly idea on how to style your WordPress sidebar. Now be creative, create something unique. Your imagination is the limit… ;)



Hey, óptimo post ! :D
Vai-me ajudar bastante num futuro próximo.
Parabéns ! :)
Abraços
Bom artigo, gostava é de saber como adicionas esses banners (Subscrive RSS e Bookmark) no final dos posts (é com algum plugin?)…
Cumps
Outro bom artigo!
Tenho a mesma dúvida que o edumicro… :(
Olha podes me explicar como criaste o widget Text,HTML e PHP?!? Não entendi essa parte :S
Ok. A cena no final dos posts é algo à parte, não é nenhum plugin, fui eu mesmo que programei e meti dentro do template.
Quanto à Text. HTML e PHP como disse é um Widget de texto que faz parte do K2 Theme. Agora se utilizam o sistema normal de Widgets deve haver um Text Widget e deve fazer o mesmo efeito. :)
excelente tut greven!
Very nice look. I do find the white on black attractive, but a little hard on the eyes (maybe it’s just my age;-) ). I had a similar need recently to widen my K2 sidebar, and initially thought it would be hard, but like you found that once I got started it was quite straightforward.
Rods last blog post… No thank you, I don’t need penis enlargement
@Rod – I will probably have to do the same, Rod. Widen the sidebar.
Thank you for your comment. :)
nice tutorial?
sundymes last blog post… ???????
Thank you for your website :-)
I made with photoshop backgrounds for myspace,youtube and ect..
my backgrounds:http://tinyurl.com/5b8ksl
have a great day and thank you again!
How can we add scaleable background graphics to the sidebar?
Hi, I have a Q about the K2 theme Im using and I think you know what to do. I want to use the “K2 About” on all my pages/sidebar (not only frontpage). Do you know how to do it? I have tried to find an answer everywhere and now Im asking you. :)
/Linus
Hi Linus! :]
I don’t use K2 myself since I redesigned my webpage from scratch. K2 is a very nice framework, only problem I see with it, is that it sometimes breaks when a new WordPress update is out. That gave me a lot of headaches, so I decided to make a theme that didn’t need to use any kind of theme framework.
Now to your question. If I remember right, K2 has its own Widget system. So in the K2 Widget section, where you can drag the Widgets you want to the Sidebar, you should click your About Widget, it should have an option with a list of Homepage, Pages, Posts, and you should tick each one individually so that widget shows on every page that you have. You can see an example here.
Hope that helps you with your question.
I’ve seen a different tutorial here related to theme customization, but it works, thanks
Hmm, got to “The same can be done to the other classes generated in the other Widgets (like the Tag Cloud, Post Categories, etc…).” and then it just ended. I was hoping for more.
You see, in my theme the sidebar appearance is controlled in the CSS by a class called “side_roll”. I have a widget installed for comments called Get Recent Comments, and the styling for that is controlled in the widget PHP files by an id called “get_recent_comments_wrap”.
I understand from your tutorial that I could style the appearance of my sidebar widgets by changing the existing values for “side_roll”, which is located in my theme’s main stylesheet.
However, if I do that, then it will change the appearance of ALL my sidebar widgets, since they are all controlled by the “side_roll”. This wouldn’t necessarily be a bad thing, but I do have some widgets I have styled myself which are still contained within the “side_roll” parameters.
It would be nice to know how to go about styling some of my sidebar widgets so they would all have a certain unique appearance. That’s what I was hoping to discover when I came here. If you know of any tutorials on how to accomplish this I would appreciate the links.
Thank you.
Hi Doug. :) This is a pretty “old” tutorial, well it’s not old but isn’t something I’m not using on my current theme since I built it from zero.
But I can try to help you. So you just want to style some specific widgets? It kinda depends on how your theme CSS and XHTML is structured, that is, if the output of the Widgets give you a unique selector that you can work up with.
What I advise you is to use a tool like Firebug, if you aren’t using it already, it’s really helpful to deconstruct website styling and structure.
From what I could gather in your website, the Widget your are trying to style is the Tabbed Recent Comments one, right? It’s the one that doesn’t share the same style with the others. I could retrieve that that widget has a Div Wrapper with a class: “menu tabbed”. So all you have to do is style that widget selecting it using that class. Try it now and tell me what you could come up with. :)
Hope I helped…
Greven, thanks for your help in figuring out how to style my recent comments widget. Appreciate it.
You’re welcome, Doug. :)
Thanks, used some of your styling tips on my site!