Support » Fixing WordPress » Conditional Template page navigation… help!

  • Resolved drewbarden

    (@drewbarden)


    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 } ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter drewbarden

    (@drewbarden)

    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???

    Thread Starter drewbarden

    (@drewbarden)

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional Template page navigation… help!’ is closed to new replies.