• I have my page template set up with this code included:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    			<h1><?php the_title(); ?></h1>	
    
                <hr />
    				<?php the_content('<p>Read the rest of this page &rarr;</p>'); ?>
    				<? /*php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); */?>
    
    			<?php endwhile; endif; ?>
    
    			<?php
    			if (is_page('news') ){
    	       query_posts("category_name=news&showposts=5");
    		   include (TEMPLATEPATH . '/summarydisp.php');
    		   }
    		   ?>
    
            <?php
    			if (is_page('features') ){
    	       query_posts("category_name=features&showposts=1");
    		   include (TEMPLATEPATH . '/summarydisp.php');
    
    		   }
    		   ?>

    It works great, and gives me both static content and the posts i requests.

    In /summardisp.php I have the following:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    			<h2><a href="<?php the_permalink() ?>" rel="bookmark" title=" <?php the_title(); ?>"><?php the_title(); ?></a></h2>
                <h4><?php the_time('F jS, Y') ?></h4>
    			<?php /*?><!-- by <?php the_author() ?> --> &middot; <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?><?php */?>
    
    			<?php the_tags('Tags: ',' , ','<br />'); ?>
    			<?php global $more; $more = false; ?>
    				<?php the_content('<div id="more">[lang_en]continue reading &rarr; [/lang_en][lang_es]Leer más &rarr;[/lang_es] </div>'); ?>
                    <?php $more = true; ?>
    
    			<?php /*?>if ('open' == $post-> comment_status) { ?>
    			<p class="tagged"><a href="<?php the_permalink() ?>#comments"><?php comments_number('No Comments', '1 Comment', '% Comments'); ?></a></p>
    
    			<?php } else { ?>
    
    			<?php */?>
    
    			<?php endwhile; endif; ?>
    
                <?php include (TEMPLATEPATH . '/navigation.php'); ?>

    Which also works fine.

    the template file navigation.php looks like this:

    <?php if (is_single()) : ?>
    <div id="postnavigation">
    
        <span class="fl"><?php previous_post_link('&larr; %link') ?></span>
        <span class="fr"><?php next_post_link('%link &rarr;') ?></span>
        <br />
    
    </div>
    <div class="cl"></div>
    
    <?php else : ?>
    
    <div id ="pagenavigation">
        <span class="fl"><?php posts_nav_link('','','&laquo; Previous Entries') ?></span>
    	<span class="fr"><?php posts_nav_link('','Next Entries &raquo;','') ?></span>
       </div>
       <div class="cl"></div>
    <?php endif; ?>

    Which, theoretically should work fine.

    The problem is, a page that is only supposed to show one article and then paginate through previous and next posts, doesn’t. It goes to the next page but the same article appears.

    you can see what i mean here:
    https://danaherlihey.com/wordpress/features/

    im not all that php savy so any help that could be provided would be great. it seems like a problem with looping but i can’t quite figure it out.

Viewing 1 replies (of 1 total)
  • Pages are not like your index, archives, or categories and not meant to paginate through your posts. If you use conditional tags and/or custom templates, you can mix static and dynamic content on category pages.

    Also, you need to validate and fix your code because you have some major code errors that can cause all sorts of strange problems.

Viewing 1 replies (of 1 total)
  • The topic ‘post_nav_link / next_posts not working – php help!’ is closed to new replies.