Array Problem with Multiple Loops on the same page
-
I was following the codex entry on doing multiple loops on the same page. I have both loops going but my problem is that my first loop is multiple posts and my 2nd loop is multiple posts, thus I need to do the “$do_not_duplicate” part as an array however when I follow the codex thing i get this.
atal error: Cannot use [] for reading in /nfs/c02/h04/mnt/25450/domains/pensfast.com/html/wp-content/themes/prebuilt/sliders/sale_slider.php on line 4
Any ideas why this is happening and how I can fix this? Here are the snippets of code from the two loops.
The first one:
<?php $my_query = new WP_Query('is_sticky'); while (have_posts()) : the_post(); if( $post->ID = $do_not_duplicate[] ) continue; update_post_caches($posts); ?>
The second one:
<?php $my_query = new WP_Query('showposts=4') ?> <?php if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); if($post->ID == $do_not_duplicate[0] || $post->ID == $do_not_duplicate[1] || $post->ID == $do_not_duplicate[2]) continue; update_post_caches($posts); ?>
Also the other thing that was stumping me and I’m not sure if this is related, but when I do the showposts thing in the query, it doesn’t show the amount I put, it’s always more. If I put 1 for example, it’ll show 8. Thanks.
- The topic ‘Array Problem with Multiple Loops on the same page’ is closed to new replies.