wp函数wp_get_recent_posts

[insert_php] 

$args = array( 'category' => 1,'numberposts' => '2', );

$recent_posts = wp_get_recent_posts($args);

foreach( $recent_posts as $recent ){

echo '<li><a href="' . get_permalink($recent["ID"]) . '">' .   $recent["post_title"].'</a> </li> ';

}[/insert_php]

详细请看http://codex.wordpress.org/Function_Reference/wp_get_recent_posts

猜你喜欢

转载自yantaoliu2006.iteye.com/blog/2282418