Multiple loops with in a conditional statement
-
So I created a template and I’m trying to query specific posts with different tags within the same category by page using a conditional statement. I’m not the greatest at php and was wondering if someone might be able to help me out or point me in the right direction.
Thanks in advance.
My code:
<?php if (is_page('1')) { Loop 1 } elseif (is_page('2')) { loop 2 } else { //default loop of all tags within category 21// <?php $args = array('cat' => '21', 'posts_per_page' => 10, 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),); query_posts($args); while (have_posts()) : the_post(); ?> <?php global $more; $more = 0; ?> <div class="blue"> <div id="post-header"> <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2> <div class="clear"></div> <p>Posted on <?php the_time('F jS, Y'); ?> by <?php the_author(); ?></p> </div> <div class="clear"></div> <div class="entry"> <?php the_content('Read More...'); ?> </div> <div id="post-footer"> <p><?php comments_popup_link('Respond to this post »', '1 Response »', '% Responses »'); ?> • <?php the_tags('Tags: ', ', ', '<br>'); ?></p> </div> <div class="clear"></div> </div> <?php endwhile; ?> } ?>The default query works by itself but when I place it in the conditional statement I get an error.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Multiple loops with in a conditional statement’ is closed to new replies.