Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <?php $the_query = new WP_Query( 'posts_per_page=5' ); ?>
  2. <?php $postLoops = 0 ?>
  3.  
  4. <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
  5. <?php $postLoops++;
  6. if ($postLoops == 2) {
  7. echo '<div class="post-right-half">';
  8. }
  9. if ($postLoops == 1) {
  10. echo '<div class="post-left-half">';
  11. }
  12.  
  13. ?>
  14. <div class="post-square">
  15. <div class="post-thumbnail" style="background-image: url(<?php the_post_thumbnail_url(); ?>);"><br></div>
  16. <div class="content-half">
  17. <h2 class="post-title"><?php the_title(); ?></h2>
  18. <p class="post-content"><?php the_excerpt(__('(more…)')); ?</p>
  19. <a class="read-more" href="<?php the_permalink() ?>">Read More <i class="fa fa-angle-right" aria-hidden="true"></i></a>
  20. </div>
  21. </div>
  22.  
  23. <?php
  24. if ($postLoops == 3) {
  25. echo '</div>';
  26. }
  27. if ($postLoops == 1) {
  28. echo '</div>';
  29. }
  30. ?>
  31.  
  32. <?php
  33. endwhile;
  34. wp_reset_postdata();
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement