Problem using query_posts()
-
Below is the code I am using.
The problem I am getting is that the date call in the second block does not return any data.
Can anyone tell what I am doing wrong?<?php query_posts('posts_per_page=1&category_name=Cat1'); ?> <?php if (have_posts()) : the_post(); ?> <div class="widget latest-post"> <span class="latest-title">Latest Cat 1 Post</span><br /> <span class="date"><?php the_date(); ?></span><br /> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <?php the_excerpt(); ?> </div> <!-- END Latest Posts --> <?php endif; wp_reset_query(); ?> <?php query_posts('posts_per_page=1&category_name=Cat2'); ?> <?php if (have_posts()) : the_post(); ?> <div class="widget latest-post"> <span class="latest-title">Latest Cat 2 Post</span><br /> <span class="date"><?php the_date(); ?></span><br /> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <?php the_excerpt(); ?> </div> <!-- END Latest Posts --> <?php endif; wp_reset_query(); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Problem using query_posts()’ is closed to new replies.