WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] posts_nav_link keeps showing same posts (4 posts)

  1. nipponese
    Member
    Posted 5 years ago #

    For some reason when I use posts_nav_link, I keep getting the same posts and it won't show the older, or new posts.

    Is it a problem that I am using <?php query_posts('category_name=news'); ?> before The Loop?

  2. stvwlf
    Member
    Posted 5 years ago #

    You need to add some additional code to resolve that.

    Change your query posts to this

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
          query_posts("category_name=news&paged=$paged"); ?>

    make sure you have double quotes around the query_posts parameters

  3. nipponese
    Member
    Posted 5 years ago #

    Thank you!

  4. Hexa6oN
    Member
    Posted 5 years ago #

    I'm having the same problem and I tried this with no avail. Please help.

    This is the page: http://www.goliathlabs.com/goliath2009/articles/

    This is my code:

    <div class="articles-container grid_8">
    			<?php
    			$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    			$args=array(
    			   'categore_name'=>articles,
    			   'paged'=>$paged,
    			   );
    			query_posts($args);
    			?>
    			<?php while (have_posts()) : the_post(); ?>
    			<h1><a href="<?php the_permalink(); ?>">
    				<?php the_title_attribute(); ?>
    				</a></h1>
    			<h2>
    				<?php meta(subheading); ?>
    			</h2>
    			<div class="body-text">
    				<?php
    				global $more;
    				$more = 0;
    				?>
    				<?php the_content('<p>&raquo; Read full article&hellip;</p>'); ?>
    			</div>
    			<?php endwhile;?>
    			<?php posts_nav_link(' — ', __('&laquo; Newer Posts'), __('Older Posts &raquo;')); ?>
    		</div>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.