How does wp_get_recent_posts work regarding date posted and comments?
-
I want to grab the post date as well as post other post information while using wp_get_recent_posts but it seems to be missing from the options it takes. I also wanted the posts comment count I ended up just using get_comments_number() but I’m not sure if that’s the correct thing to do. Anyone have any pointers?
$args = array( 'numberposts' => $show_count ); $recent_posts = wp_get_recent_posts( $args ); echo '<ul>'; foreach( $recent_posts as $recent ) { echo '<li>'; echo '<a href="' . get_permalink($recent["ID"]) . '" title="Look '.$recent["post_title"].'" >' . $recent["post_title"].'</a>'; echo '<div>September 4, 2012'; // $comment_count = get_comments_number(); if( $comment_count >= 0 && $show_comment_count == TRUE) { echo ' - ' . $comment_count . ' COMMENTS'; } echo '</div>'; echo '</li>'; } echo '</ul>';
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How does wp_get_recent_posts work regarding date posted and comments?’ is closed to new replies.