Guest User

Untitled

a guest
Dec 9th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <div class="top-posts">
  2. <?php
  3. if (have_posts()) :
  4. while(have_posts()) : the_post();?>
  5. <div class="content">
  6. <?php the_post_thumbnail('archive'); ?>
  7. <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
  8. </div>
  9. <?php endwhile;?>
  10. <?php endif;?>
  11. </div>
  12.  
  13. <div class="primary-posts">
  14. <?php
  15. if (have_posts()) :
  16. while(have_posts()) : the_post();?>
  17. <h2><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h2>
  18. <?php endwhile;?>
  19. <?php endif;?>
  20. </div>
  21.  
  22. $cat_id = $wp_query->get_queried_object_id()
  23.  
  24. $args = array (
  25. 'cat' => $cat_id,
  26. 'posts_per_page' => 2,
  27. )
  28.  
  29. $the_query = new WP_Query ($args);
  30. if ($the_query->have_posts()) {
  31. while ( $the_query->have_posts() ) {
  32. $the_query->the_post();
  33. // display stuff
  34. }
  35. wp_reset_postdata(); // restore the original archive loop
  36. }
  37.  
  38. <?php
  39. rewind_posts();
  40. if (have_posts()) :
  41. while(have_posts()) : the_post();?>
  42. <h2><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h2>
  43. <?php endwhile;?>
  44. <?php endif;?>
Add Comment
Please, Sign In to add comment