Display 5 most recent posts in thesis


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function home_recent_post() {
  2. if (is_front_page()) {
  3. echo '<ul>Recent Posts';
  4. $my_query = new WP_Query('showposts=5');
  5. while ($my_query->have_posts()) : $my_query->the_post();
  6. echo '<li>';
  7. the_title();
  8. the_excerpt();
  9. echo '</li>';
  10. endwhile;
  11. echo '</ul>';
  12. }
  13. wp_reset_query();
  14. }
  15.  
  16. add_action ('thesis_hook_after_post','home_recent_post');

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.