recent-posts.php 823 B

123456789101112131415161718192021222324252627
  1. <?php
  2. $recent = new WP_Query( array(
  3. 'posts_per_page' => 4,
  4. 'no_found_rows' => true,
  5. 'ignore_sticky_posts' => true,
  6. ) );
  7. ?>
  8. <?php if ( $recent->have_posts() ) : ?>
  9. <div id="front-page-recent-posts" class="recent-posts">
  10. <div class="recent-posts-wrapper">
  11. <h2 class="recent-posts-title"><?php echo esc_html_e( 'Recent Posts', 'karuna' ); ?></h2>
  12. <div class="grid-row">
  13. <?php
  14. while ( $recent->have_posts() ) : $recent->the_post();
  15. get_template_part( 'components/features/recent-posts/content', 'recent-posts' );
  16. endwhile;
  17. wp_reset_postdata();
  18. ?>
  19. </div>
  20. <a class="more-recent-posts button" href="<?php echo esc_url( get_permalink( get_option( 'page_for_posts' ) ) ); ?>">
  21. <?php esc_html_e( 'More Posts', 'karuna' ); ?>
  22. </a>
  23. </div>
  24. </div>
  25. <?php endif;