WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Conditional Template page navigation... help! (3 posts)

  1. drewbarden
    Member
    Posted 4 years ago #

    I need some pagination help. I'm using WordPress' posts_nav_link() tag. When displaying page 2–or any other for that matter–it doesn't display the posts. I've built this custom template from the ground up, so I'm sure it's something simple that I'm missing. The template is all conditionals, including conditionals controlling code when viewing each individual category archive. I have one fundamental question:

    When viewing a page such as 'page 2,' what template does it pull from, and how? My code for this category in the archives is below:

    <?php } elseif (in_category('news_media')) { ?>
    		<div class="grid_12 relative wide_top">
    			<div id="bookmarks" class="grid_5">
    				SIDEBAR CONTENT
    			</div>
    
    				<?php if (have_posts()) : ?>
    					<?php while (have_posts()) : the_post(); ?>
    						<div class="news_col1 grid_5 prefix_1">
    							NEWS + MEDIA CONTENT
    						</div>
    					<?php endwhile; ?>
    				<?php endif; ?>
    				<div class="pagination prefix_1 grid_5">
    					<?php posts_nav_link('|','Previous','Next'); ?>
    				</div>
    		</div>
    
    	<?php } ?>
  2. drewbarden
    Member
    Posted 4 years ago #

    However if I add the last else statement, page 2 ends up displaying "Else"

    <?php } elseif (in_category('news_media')) { ?>
    		<div class="grid_12 relative wide_top">
    			<div id="bookmarks" class="grid_5">
    				SIDEBAR CONTENT
    			</div>
    
    				<?php if (have_posts()) : ?>
    					<?php while (have_posts()) : the_post(); ?>
    						<div class="news_col1 grid_5 prefix_1">
    							NEWS + MEDIA CONTENT
    						</div>
    					<?php endwhile; ?>
    				<?php endif; ?>
    				<div class="pagination prefix_1 grid_5">
    					<?php posts_nav_link('|','Previous','Next'); ?>
    				</div>
    		</div>
    
    	<?php } else { ?>
    
    	Else
    
    	<?php } ?>

    What's the problem???

  3. drewbarden
    Member
    Posted 4 years ago #

    Ummm I found a plugin, Category-Pagination-Fix, which fixed the problem.

Topic Closed

This topic has been closed to new replies.

About this Topic