Getting Recent Posts in WordPress
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 ZackLive.com.
Discuss in our Forum
Archives, Codes, Codex, Hacks, Theme, Widget, WordPress

[...] article is also posted at Gearor.com. Subscribe our RRS Feed for news updates, or follow us on Twitter. AKPC_IDS += [...]
This may be the simplest way to get recent posts in WordPress.