Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. $q = new WP_Query( 'posts_per_page=5' );
  2.  
  3. $args = array (
  4. 'post_type' => 'custom_post',
  5. 'nopaging' => false,
  6. 'posts_per_page' => '5',
  7. 'order' => 'DESC',
  8. 'orderby' => 'ID',
  9. );
  10.  
  11. $query = new WP_Query( $args );
  12.  
  13. if ( $query->have_posts() ) {
  14. while ( $query->have_posts() ) {
  15. $query->the_post();
  16. // display content
  17. }
  18. } else {
  19. // display when no posts found
  20. }
  21.  
  22. wp_reset_postdata(); // Restore original Post Data
  23.  
  24. $args = array(
  25. 'post_type' => 'blog_posts',
  26. 'posts_per_page' => '5',
  27. );
  28.  
  29.  
  30. $query = new WP_Query($args);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement