Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // First loop
- $args_dogs = array(
- 'post_type' => array('animals'),
- 'posts_per_page' => '3',
- 'tax_query' => array(
- array(
- 'taxonomy' => 'species',
- 'field' => 'slug',
- 'terms' => 'chien',
- ),
- ),
- 'orderby' => 'date',
- );
- $query_dog = new WP_Query( $args_dogs );
- if ( $query_dog->have_posts() ) : ?>
- <?php while ( $query_dog->have_posts() ) : $query_dog->the_post(); ?>
- <?php get_template_part( 'template-parts/publication-animaux' ); ?>
- <?php endwhile; ?>
- <?php endif; ?>
- <?php wp_reset_postdata(); ?>
- // second loop
- $args_cat = array(
- 'post_type' => array('animaux'),
- 'posts_per_page' => '3',
- 'tax_query' => array(
- array(
- 'taxonomy' => 'species',
- 'field' => 'slug',
- 'terms' => 'chat',
- ),
- ),
- 'orderby' => 'date',
- );
- $query_cat = new WP_Query( $args_cat );
- if ( $query_cat->have_posts() ) : ?>
- <?php while ( $query_cat->have_posts() ) : $query_cat->the_post(); ?>
- <?php get_template_part( 'template-parts/publication-animaux' ); ?>
- <?php endwhile; ?>
- <?php endif; ?>
- <?php wp_reset_postdata(); ?>
- // the third loop use args for display the last sticky post
- $args_sticky = array(
- 'posts_per_page' => 1,
- 'post__in' => get_option( 'sticky_posts' ),
- 'ignore_sticky_posts' => 1
- );
- $query_sticky = new WP_Query( $args_sticky );
- // the four loop use args for display last posts and ignore sticky post
- $args_home = array(
- 'posts_per_page' => 4,
- 'post__not_in' => get_option('sticky_posts')
- );
- $query_home = new WP_Query( $args_home );
- // the five loop use args for display elements of cpt slider
- $slider_args = array(
- 'post_type' => array('slider'),
- 'posts_per_page' => -1,
- 'order' => 'DESC',//
- );
- $slider = new WP_Query($slider_args);
Add Comment
Please, Sign In to add comment