Trouble with next_posts_link() on page of posts
-
I am pretty new to WordPress, and have a difficult time with creating navigation links on a page of posts.
This seems to work, except that the next and previous links only show the same two posts – although the page number in the url changes. When changing the showposts=2 to 8, all the 8 posts are shown in one page.
<?php $query_string = "'cat=5,3&posts_per_page=2&paged='.$paged.'&orderby=date&order=asc'"; $posts = query_posts( $query_string ); if( $posts ) : ?> <div class="post"> <h1>Ordered by Post Title (Ascending)</h1> <?php foreach( $posts as $post ) : setup_postdata( $post ); ?> <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2> <p><?php the_content(); ?></p> <?php endforeach; ?> </div> <?php endif; ?> <div class="navigation"> <?php // $paged = $paged + 1; ?> <div class="alignleft"><?php next_posts_link('? Older articles') ?></div> <div class="alignright"><?php previous_posts_link('Newer articles ?') ?></div>
I don’t understand the life cycle of $paged–and sure neither a lot some other necessary stuff here.
Any help appreciated!
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Trouble with next_posts_link() on page of posts’ is closed to new replies.