posts_nav_link
-
<div id=”content_news”>
<?php if(is_home() || is_front_page()) {
$page = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
query_posts(‘showposts=1&paged=’.$page.’&posts_per_page=5′);
}
if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<div class=”post” id=”post-<?php the_ID(); ?>”>
<h2 class=”post_title”><?php the_title(); ?>.</h2>
<div class=”post_content”>
<h3 class=”post_meta”><?php the_date(); ?> by <?php the_author(); ?></h3>
<?php the_content(); ?>
</div>
</div><?php endwhile; endif;?>
<div id=”news_list”>
<?php
$page = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
query_posts(“cat=5&showposts=5&paged=$page”);
?><?php while (have_posts()) : the_post();?>
<h2 class=”post_title”>
“><?php the_title(); ?>
</h2>
<?php endwhile; ?>
<div class=”navigation”>
<?php posts_nav_link(‘ :: ‘,’previous’,’next’); ?>
</div>
</div>
</div>
</div>this is the code so far.
It shows the last post (title+content) on top when you first open the page,
and it lists 5 titles from a specific category.
and “next” or “previous” at the bottom if there are more than 5 posts in the category.
Now, the problem is that,
let’s say there are ten posts, 1-10, one being the most recent post.
When you first go to the page,
it show the most recent post (title+content), post 1
plus just the titles of posts 1-5.
If you click on “next” to see the next 5 posts,
I want to show the last post (title+content) from the remaining five posts, post 6
plus the titles of posts 6-10.
What it does now when I click on next is
it shows post 1, or the last post viewed on top,
plus the titles of posts 6-10.
And when I click on let’s say post 7,
the lists of titles goes back to 1-5.How can I make it so the list of posts changes only
when I click on next or previous.????
- The topic ‘posts_nav_link’ is closed to new replies.