Most WordPress themes, by default, come with Recent Posts displayed automatically. Depending on the type of blog you run, it is possible that you would prefer to display Recent Posts per category. If this is the case, here is what you need to do to only display recent posts for specific categories.
First, you’ll want to find your Recent Posts code, which is usually found in the sidebar. It will look something like this:
<h2>Recent Posts</h2>
<ul>
<?php get_archives('postbypost', 10); ?>
</ul>
As always, make sure you have a backup of the file in question before making any changes. You’ll then want to replace the above code with the following code:
<ul>
<?php $recent = new WP_Query("cat=1&showposts=10"); while($recent->have_posts()) : $recent->the_post();?>
<li><a href="<?php the_permalink() ?>" rel="bookmark">
<?php the_title(); ?>
</a></li>
<?php endwhile; ?>
</ul>
Where is says cat=1, you’ll want to insert the number assigned to the category that you want to display the posts from. You can find this from your Manage -> Categories page. You can also adjust the number of posts to be displayed where it says showposts=10.
This could be useful to someone who wants to display the most recent few posts from a few different categories in their sidebar.
It looks like the WordPress team has released what is classified as an urgent security release, primarily to fix a security flaw for WordPress blogs with registration enabled. It is recommended that everyone make the upgrade as soon as possible. The release also comes with a few minor bug fixes.
According to the WordPress team, this could be a pretty easy upgrade, as you only need to override the xmlrpc.php file to fix the security concerns. If you want all the bug fixes, you’ll need to do a full upgrade.
As a quick side note, they are also recommending users of the WP-Forum plugin deactivate it until the author is able to fix a vulnerability.
The first month of 2008 is now complete and this blog is celebrating the completion of its fourth month of existence. This blog has continued to exceed my expectations. It’s getting a good amount of traffic, and the subscriber count is quickly approaching 600 subscribers. There has also been some great conversations in the comments, as well, which is probably my favorite part.
In case you’re new to Hack WordPress, I like to wrap up each month with a quick post covering the most popular posts for that month. Here is some of January’s most popular posts:
- Premium WordPress Themes Gallery
- How To: Adding an Author Page to Your WordPress Theme
- How To: Blocking Your WordPress Categories and Archives From Google
- Premium Theme: PolaroidPress
- Support WordPress by Displaying Gravatars On Your Blog
Thanks to everyone for supporting Hack WordPress through reading, comments, and inbound links. I would also like to take this opportunity to thank this months sponsors!
- PremiumPress - Magnus is a freelance web designer with a couple premium WordPress themes for sale.
- Adii - Adii is the WordPress rockstar responsible for the Premium News theme series.
If you have WordPress themes, WordPress plugins, or other WordPress related products and services that you’d like to promote, we still have one advertising spot available. Please check out our advertising page, then contact us.
Also, if you enjoy writing about WordPress, we now have a couple writing positions available. Check out this page for more details!
I’ve finally gotten around to releasing Slick Blue, which is my first free WordPress theme. Here is a screenshot:
Slick Blue is a 2-column widget-ready theme that features the following:
- 125×125 Banner Slots - Just replace the pictures and links with the appropriate code in the 125×125 banners file.
- SEO Friendly - I have gone through the code to make it as optimized for search engines as possible, using the appropriate headers, etc.
- Advertising Friendly - In addition to the banner slots mentioned above, you can easily plugin in PPC code (Google AdSense, BidVertiser or Yahoo Publishers Network) in the appropriate php file (named AdSenseLinks, AdSenseBanner, AdSenseBlocks).
- Widget-Ready - Theme is widget-ready.
- Comments/Trackbacks - I have separated the comments and trackbacks to help your readers follow comment conversations.
- Gravatars - Features built-in Gravatar support (no plugin required).
- Social Networking - Built-in social networking buttons below each post.
- Improved Footer - I’ve moved most of the archives to the footer. This is also a great place to put a MyBlogLog widget if you prefer to have one on your blog.
- Plugin Support - Is already setup to work with several WordPress plugins.
You should be able to find everything you need here, including a demo and a link to download. All feedback is welcome!
With the recent popularity of themes attempting to turn WordPress into a content management system (CMS), people have begun purchasing premium WordPress themes in order to get the features and look they are wanting for their website.
As Josh Byer’s points out, people can instead use free WordPress plugins to achieve much of the CMS functionality they are looking for. Miriam of WordPress Garage also adds that a few additional plugins to turn WordPress into a CMS.
While using a theme designed specifically to function as a CMS has a few advantages, I think those of us that are on a budget can definitely get many of the CMS features we crave through the use of these WordPress plugins.
If you were looking to purchase/download a CMS, what options are you most looking for? Can you get this functionality via plugins? I’d love to get everyones thoughts on this!
In the past we’ve gone over some methods for setting up your theme to separate your author comments in WordPress. By default, most WordPress themes check the e-mail address to determine who the person is that is leaving the comment. By adjusting the code to check for the user id instead, you can set up your theme to recognize if you are the author of the post. This is also beneficial for blogs with multiple authors.
In addition to separating trackbacks from comments, this is another way you can easily help improve the readers experience when trying to follow a conversation in the comments. Most people use a different background, but some choose to instead display a logo. The important thing is that readers can recognize which comments are coming from the author of the post.
Today I noticed Matt Cutts has written his own tutorial explaining how to highlight author comments in WordPress. His post also includes the code needed for CSS styling. If you still haven’t gotten around to doing this on your theme yet, I recommend you check it out!












