I have two loops on my page - each with their own category. It works, but I don't know if this is the best practice as I'm pretty new to this stuff.
<?php $my_query = new WP_Query( 'category_name=news&posts_per_page=3' );
while ( $my_query->have_posts() ) : $my_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<!-- Do stuff... -->
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php $second_query = new WP_Query( 'category_name=reviews&posts_per_page=4' );
while ( $second_query->have_posts() ) : $second_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<!-- Do stuff... -->
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
I have two loops on my page - each with their own category. It works, but I don't know if this is the best practice as I'm pretty new to this stuff.
<?php $my_query = new WP_Query( 'category_name=news&posts_per_page=3' );
while ( $my_query->have_posts() ) : $my_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php $second_query = new WP_Query( 'category_name=reviews&posts_per_page=4' );
while ( $second_query->have_posts() ) : $second_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
I have two loops on my page - each with their own category. It works, but I don't know if this is the best practice as I'm pretty new to this stuff.
<?php $my_query = new WP_Query( 'category_name=news&posts_per_page=3' );
while ( $my_query->have_posts() ) : $my_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<!-- Do stuff... -->
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php $second_query = new WP_Query( 'category_name=reviews&posts_per_page=4' );
while ( $second_query->have_posts() ) : $second_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<!-- Do stuff... -->
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
I have two loops on my page - each with their own category. It works, but I don't know if this is the best practice as I'm pretty new to this stuff.
<?php $my_query = new WP_Query( 'category_name=news&posts_per_page=3' );
while ( $my_query->have_posts() ) : $my_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<!-- Do stuff... -->
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php $second_query = new WP_Query( 'category_name=reviews&posts_per_page=4' );
while ( $second_query->have_posts() ) : $second_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<!-- Do stuff... -->
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
I have two loops on my page - each with their own category. It works, but I don't know if this is the best practice as I'm pretty new to this stuff.
<?php $my_query = new WP_Query( 'category_name=news&posts_per_page=3' );
while ( $my_query->have_posts() ) : $my_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<!-- Do stuff... -->
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php $second_query = new WP_Query( 'category_name=reviews&posts_per_page=4' );
while ( $second_query->have_posts() ) : $second_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<!-- Do stuff... -->
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
I have two loops on my page - each with their own category. It works, but I don't know if this is the best practice as I'm pretty new to this stuff.
<?php $my_query = new WP_Query( 'category_name=news&posts_per_page=3' );
while ( $my_query->have_posts() ) : $my_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php $second_query = new WP_Query( 'category_name=reviews&posts_per_page=4' );
while ( $second_query->have_posts() ) : $second_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
WordPress: Multiple Loops - Best practice?multiple loops
I have two loops on my page - each with their own category. It works, but I don't know if this is the best practice as I'm pretty new to this stuff.
<?php $my_query = new WP_Query( 'category_name=news&posts_per_page=3' );
while ( $my_query->have_posts() ) : $my_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<!-- Do stuff... -->
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php $second_query = new WP_Query( 'category_name=reviews&posts_per_page=4' );
while ( $second_query->have_posts() ) : $second_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<!-- Do stuff... -->
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
WordPress: Multiple Loops - Best practice?
I have two loops on my page - each with their own category. It works, but I don't know if this is the best practice as I'm pretty new to this stuff.
<?php $my_query = new WP_Query( 'category_name=news&posts_per_page=3' );
while ( $my_query->have_posts() ) : $my_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<!-- Do stuff... -->
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php $second_query = new WP_Query( 'category_name=reviews&posts_per_page=4' );
while ( $second_query->have_posts() ) : $second_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<!-- Do stuff... -->
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
WordPress: multiple loops
I have two loops on my page - each with their own category. It works, but I don't know if this is the best practice as I'm pretty new to this stuff.
<?php $my_query = new WP_Query( 'category_name=news&posts_per_page=3' );
while ( $my_query->have_posts() ) : $my_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<!-- Do stuff... -->
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php $second_query = new WP_Query( 'category_name=reviews&posts_per_page=4' );
while ( $second_query->have_posts() ) : $second_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<!-- Do stuff... -->
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>