Getting recent posts in you WordPress blog, is a old topic. WordPress now has a default widget to do this, but sometime we need to display recent posts outside of the widget area. It’s a simple task, you can use one line of codes to do it:
<?php wp_get_archives(‘title_li=&type=postbypost&limit=10′); ?>
The function wp_get_archives() is used to display a date-based archives list. While setting ‘type’ to ‘postbypost’, it returns posts odered by post date, which means recent posts, that’s what we want. And then we need to set the limit of posts by ‘limit=10′. That’s it, we have 10 recent posts now, you can put this codes into wherever in your theme.
For detail of wp_get_archives(), you can visit the WordPress Codex here.
This article is also posted at Gearor.com.
Feel free to visit our Forum, subscribe our RRS Feed for news updates, and follow us on Twitter.

3 Responses to “Getting Recent Posts in WordPress”
[...] article is also posted in ZackLive.com. Share this Post: Tagged with: Archives, Codes, Codex, Hacks, Theme, Widget, [...]
This may be the simplest way to get recent posts in WordPress.
[...] my post Getting Recent Posts In WordPress before, I am thinking about getting the most popular posts or most commented posts. Talking about [...]