content-recent-posts.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * Template part for displaying trio of recent posts
  4. *
  5. * @package Toujours
  6. */
  7. $latest_three = apply_filters( 'toujours-recent-posts', false );
  8. if ( ! $latest_three ) {
  9. return;
  10. }
  11. ?>
  12. <div id="featured-post-trio" class="clear">
  13. <div class="wrap">
  14. <?php
  15. $recent_posts = new WP_Query( array(
  16. 'post__in' => (array) $latest_three,
  17. 'ignore_sticky_posts' => 1,
  18. 'posts_per_page' => '3',
  19. ) );
  20. while ( $recent_posts->have_posts() ) : $recent_posts->the_post();
  21. ?>
  22. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  23. <?php if ( has_post_thumbnail() ) { ?>
  24. <?php if ( has_post_thumbnail() ) { ?>
  25. <div class="featured-image">
  26. <span>
  27. <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'toujours-trio' ); ?></a>
  28. </span>
  29. </div>
  30. <?php } ?>
  31. <?php } ?>
  32. <div class="entry-text">
  33. <header class="entry-header">
  34. <?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
  35. <div class="entry-meta">
  36. <?php toujours_posted_on(); ?>
  37. </div><!-- .entry-meta -->
  38. </header><!-- .entry-header -->
  39. <div class="entry-content">
  40. <?php the_excerpt(); ?>
  41. </div><!-- .entry-content -->
  42. <footer class="entry-footer">
  43. <?php toujours_entry_footer(); ?>
  44. </footer><!-- .entry-footer -->
  45. </div><!-- .entry-text -->
  46. </article><!-- #post-## -->
  47. <?php
  48. endwhile;
  49. wp_reset_postdata();
  50. ?>
  51. </div><!-- .wrap -->
  52. </div><!--/. featured posts -->