Guest User

Untitled

a guest
Feb 18th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. // First loop
  2. $args_dogs = array(
  3. 'post_type' => array('animals'),
  4. 'posts_per_page' => '3',
  5. 'tax_query' => array(
  6. array(
  7. 'taxonomy' => 'species',
  8. 'field' => 'slug',
  9. 'terms' => 'chien',
  10. ),
  11. ),
  12. 'orderby' => 'date',
  13. );
  14. $query_dog = new WP_Query( $args_dogs );
  15. if ( $query_dog->have_posts() ) : ?>
  16. <?php while ( $query_dog->have_posts() ) : $query_dog->the_post(); ?>
  17. <?php get_template_part( 'template-parts/publication-animaux' ); ?>
  18. <?php endwhile; ?>
  19. <?php endif; ?>
  20. <?php wp_reset_postdata(); ?>
  21.  
  22.  
  23.  
  24. // second loop
  25. $args_cat = array(
  26. 'post_type' => array('animaux'),
  27. 'posts_per_page' => '3',
  28. 'tax_query' => array(
  29. array(
  30. 'taxonomy' => 'species',
  31. 'field' => 'slug',
  32. 'terms' => 'chat',
  33. ),
  34. ),
  35. 'orderby' => 'date',
  36. );
  37. $query_cat = new WP_Query( $args_cat );
  38. if ( $query_cat->have_posts() ) : ?>
  39. <?php while ( $query_cat->have_posts() ) : $query_cat->the_post(); ?>
  40. <?php get_template_part( 'template-parts/publication-animaux' ); ?>
  41. <?php endwhile; ?>
  42. <?php endif; ?>
  43. <?php wp_reset_postdata(); ?>
  44.  
  45. // the third loop use args for display the last sticky post
  46. $args_sticky = array(
  47. 'posts_per_page' => 1,
  48. 'post__in' => get_option( 'sticky_posts' ),
  49. 'ignore_sticky_posts' => 1
  50. );
  51. $query_sticky = new WP_Query( $args_sticky );
  52.  
  53. // the four loop use args for display last posts and ignore sticky post
  54.  
  55. $args_home = array(
  56. 'posts_per_page' => 4,
  57. 'post__not_in' => get_option('sticky_posts')
  58. );
  59. $query_home = new WP_Query( $args_home );
  60.  
  61. // the five loop use args for display elements of cpt slider
  62. $slider_args = array(
  63. 'post_type' => array('slider'),
  64. 'posts_per_page' => -1,
  65. 'order' => 'DESC',//
  66. );
  67. $slider = new WP_Query($slider_args);
Add Comment
Please, Sign In to add comment