How to Create Asides in WordPress 2.3 or up
A few themes I’ve been testing out have been failing when it comes to creating asides in the sidebar.
I wanted to put my asides in the sidebar in WordPress 2.3 and started doing some snooping through the new database structure… mainly the two tables wp_terms and wp_term_taxonomy.
You can copy and paste the following code into your sidebar (above or below the if widgetized fuction).
<li><h2>Asides</h2>
<ul>
<?php
$tagid = $wpdb->get_var("SELECT term_id FROM wp_terms WHERE slug = 'asides'");
$get_asides = new WP_Query('cat=' .$tagid. '&showposts=5&orderby=post_date&order=desc');
while ($get_asides->have_posts()) : $get_asides->the_post();
$do_not_duplicate = $post->ID; ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
</li>
The previous code basically extracts the numbered id from the category named “asides”, puts that id number into a loop that only includes 1 category (by id)… then displays just the title of that “Aside”.
I will be writing a small widgetized plugin for this when I get home this afternoon. The plans for the plugin are to offer a few options for customizing the way asides are shown.
- by category
- by tag
- have “asides” show up in categories or not
- Remove a category from the loop (or include it).
- any other features?











Hi. Great post mate. Just wanted to ask how you’ll be getting the asides to work with tags. The “cat” parameter doesn’t seem to work with tags. Is it just me?
@ZMAng - are you using WP 2.3? I’m using it on this blog and the exact same code…
I really like what you have here. I think I’ll be adding your blog to my blog roll.
J
Yeap, I am. Hmm, that’s weird. Thanks though.
@ZMAng, I missed what you were saying last time… Tags is a little bit different than WP categories… I’m looking into it and I’ll email you when I find out how to do it.
@jmill, glad you like it! I appreciate the link as well… anything you’d like to see around here?
[...] habilitar los asides esta vez utilicé el hack descrito en Creating Asides in Wordpress 2.3 que funciona a la perfección, junto con una modificación en el loop para evitar que aparezca el [...]
Leave your response!
Tweets...
Posting tweet...
Highest Rated
Most Viewed
Users Online
Categories
Blogroll
Tags
$wpdb 800 x 600 800x600 resolution 1024x768 resolution Add Categories Alexa Alexa Rank Alexa Traffic Rank A List Bloggers alternating_colors appeal to readers Asides Asides Plugin background_colors Black Hat SEO blog audience blog content Bloggercamp News Blogger Gifts Blog Gifts blogging blogging for money blogging honestly blogging mistakes Blogging Tips blog readership Boeing Boeing Services Company Categories foreach loop get_posts Google PageRank Google Webmaster Tools Personal SEO Tags The Loop Theme Reviews WAMP WAMP5 Webhost Webmaster Tools WordPress WordPress SEO WordPress TipsArchives
Recent Comments
Most Commented
Most Viewed