WordPress loop counts my featured articles’ loop posts
-
Hi everybody!
I have a problem with my loops. WordPress default loop counts (not duplicate) my featured articles’ loop posts.
I have a featured articles section showing 5 articles. The default loop is set to show 10 articles. But it just shows 5 in front page as it counts the 5 posts of the featured articles loop. When I click next it shows 10 posts, so the problem exist only in front page.
Please find below the code:
Default loop:
<?php if (have_posts()) : while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate[$post->ID] ) continue; ?> <?php the_title(); ?> <?php the_excerpt(); ?> <?php endwhile; endif; ?>
Featured posts loop:
<?php $my_query = new WP_Query('category_name=featured&showposts=5'); while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate[$post->ID] = $post->ID; ?> <?php the_title(); ?> <?php the_excerpt(); ?> <?php endwhile;?>
How to make the main loop not count the posts of the featured loop?
Thanks very much!
Banago
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘WordPress loop counts my featured articles’ loop posts’ is closed to new replies.