Multiple Loops not populating correctly
-
I have a page where I am displaying multiple loops, the code works exactly how I want it to i.e. users can navigate with the last and next buttons for the top blog category (wod-entry) and scroll through the 5 most recent posts in the bottom blog category (blog-entry). However when I try and view a specific post from the blog-entry category it will show up in the wod-entry section instead of the blog. I have tried using every bit of code I can find on multiple loops, but everything either gives me an error or disables the last and next buttons navigation function. Here is my code:
<div id="blogSection"> <h1>WOD</h1> <div id="WODSection"> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <h3 style="padding-bottom: 0px;"><?php the_title(); ?></h3> <p><?php the_content(); ?></p> <div id="nextArrow"><h3 style="color: #000000;"> <?php previous_post_link('%link', 'Last •', TRUE); ?> <?php next_post_link('%link', '• Next', TRUE); ?> </h3></div> <?php endwhile; endif; ?> </div><!-- END OF WODSECTION --> <h1 STYLE="PADDING-TOP: 20PX;">BLOG</h1> <div id="blogPost"> <?php query_posts('category_name=blog-entry&posts_per_page=5'); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <h3 style="padding-bottom: 20px;"><?php the_title(); ?></h3> <p><?php the_content(); ?></p> <p style="color: #096735; font-weight: 800;"><?php echo do_shortcode( '[feather_share]' ); ?><br />SHARE THIS POST</p> <?php endwhile; endif; ?> </div><!-- END OF BLOGPOST --> </div><!-- END OF BLOGSECTION -->
I know I did not specify my top loop to grab from the wod-entry category because when I do the next and last button navigation stops working.
Here is the web address: https://www.crossfitaevitas.com/?page_id=18
- The topic ‘Multiple Loops not populating correctly’ is closed to new replies.