Pages

Get the latest post Title, Date and Total Comments in Wordpress

Wednesday, 27 November 2013

Get the latest post Title, Date and Total Comments in Wordpress

<?php
     /*get the latest post title, date and comments*/
$args = array( 'posts_per_page' => 1, 'offset'=> 0);
$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post );
?>
      <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
      <p class="info"><?php the_date() ?>, <a href="#"><?php wp_count_comments(); ?></a></p>
<?php
endforeach;
   /*get the latest post title,date and comments*/
?>
 

Most Reading