How to Display Recent Posts in WordPress
Retrieve the most recent WordPress posts:
$recent_posts = wp_get_recent_posts( "post_type=post&numberposts=10&order=desc&orderby=id&post_status=publish", ARRAY_A ); foreach( $recent_posts as $recent ) { echo '<li>'.get_the_date('Y/m/d', $recent['ID']).' - <a href="'.get_permalink( $recent['ID'] ).'" title="'.get_the_title( $recent['ID'] ).'">'.get_the_title( $recent['ID'] ).'</a></li>'; } |
References:
Function Reference/wp_get_recent_posts
More Related Posts
- [2016/09/22] WordPress Uploaded Images are Blank
- [2016/06/12] Can’t See or Edit Content of Pos...
- [2016/05/31] Get Post Modification Date of a WordPr...
- [2016/06/04] Get Image Src for All Images on a Post...
- [2016/06/02] How to Display Most Commented Posts in...
- [2016/05/24] Get Post Permalink on WordPress
- [2016/05/24] Get Post Creation Date of a WordPress ...
- [2016/05/24] How to Manually Update WordPress