[Loop] Multiple loops on a category template
-
Hello guys.
I’m having some problems on multiple looping in my category template file.
I’m using this to list the popular posts found in the current category:<?php $popular_loop_category = new WP_Query( array('v_sortby' => 'views', 'v_orderby' => 'desc', 'posts_per_page' => '4', 'category__in' => wp_get_post_categories( $post->ID ))); if( $popular_loop_category->have_posts() ): while( $popular_loop_category->have_posts() ): $popular_loop_category->the_post(); $do_not_duplicate[] = $post->ID ?>
and on the main loop i would like to exclude the posts from the previous wp-query:
<?php query_posts(array('post__not_in'=>$do_not_duplicate)); if (have_posts()) : while (have_posts()) : the_post(); ?>
But this isn’t working because i’m doing something wrong. Any suggestions?
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘[Loop] Multiple loops on a category template’ is closed to new replies.