Implementing Asides on WP 1.5

This is a write up on how I got asides working on WordPress 1.5 using 2 different loops. It only took me about 20 minutes to setup thanks to an error on my part which cost me an extra 10 minutes. In other words, this is really easy and only takes a few minutes.

The first thing you need to do is create a category for these posts, I named mine ‘asides’ but you can use whatever name you want. Note the category ID number for this category.

You will most likely want to exclude this category from the posts on your front page, this is done very easily and explained on the WordPress Codex. In your index.php page within your theme directory you will want to add lines 3 and 5. Every WordPress theme should have the rest of the lines and you can ignore everything else in between them, that should just be the code to display each post. You will need to replace 25 with the ID number for the category you created.

The only thing left to do is add your new loop somewhere in your page to display the asides. I chose to add these in my sidebar and I used to following code.

The important lines of code here are 3,4,5, 11, and 12. Line 3 resets the loop so you can actually have a second one. It also tells the query to only pull from category 25(replace with your category ID) and to only pull the first 6, which you can also customize to your liking. Lines 4 and 5 start the new loop just like on your frontpage. Everything in between is where you would style your aside and use the template tags. Lines 11 and 12 close the loop and from there you can add whatever code you want, for example I added a link to the archives and rss feeds for asides.

Here is the CSS I used to style my asides, feel free to snag it if you like …

Popularity: 4% [?]

6 Responses to “Implementing Asides on WP 1.5”


  1. 1 Allen

    Hey BoBB, great tutorial. I got Asides errr, semi-working on my blog. The Asides itself works fine, but some of my sidebar disappears. I’m using the Equix theme, so anything under Categories disappears. Curious. I’ll play around with it more and see if I can get it down right. Otherwise, I can live without Asides.

  2. 2 BoBB

    Are you sure you have the loop and the if statement both closed? The most common reason for content disapearing would be mal-formatted php code. Let me know if you need any help with it.

  3. 3 Allen

    Yea, everything is formatted correctly.

    I actually found the problem. The Theme Changer goes wonky whenever the asides code is in there, and it doesn’t load anything under it. I just moved the Theme Changer to the very end of my sidebar, and it works like a charm. Thanks a lot.

  4. 4 BoBB

    No problem … glad I could help :-) … sort of … heh

  5. 5 Frank

    Hi, I’m trying to troubleshoot a problem with Equix. My sidebar gets pushed down below the posts in IE. I notice you have the same issue on your site… any clues how to fix it? Thanks!

  6. 6 BoBB

    I do? I never noticed that, I will have to look into that. I’ve had the problem a couple times with a couple different themes though, the problem was always that the sidebar was to wide to be displayed next to the narrow column. Even if the number of pixels add up right there is still padding etc, play with the width of the ncol or the sidebar classes in style.css, let me know if you have any luck.

Leave a Reply