Post Pagenation on Post
-
Hello Everyone,
So I am having some trouble with a template that someone else designed. The problem I am having is that gallery posts are posted in the category gallery. On the post template it calls posts in the category and lists them at the top.That way we get the gallery effect with 1 | 2 | 3 | 4 | across the top. The code they used to do this is
<ul class="nav"><?php global $post; $myposts = get_posts('numberposts=25&category=3&offset=0&order=ASC&orderby=post_date'); foreach($myposts as $post) : setup_postdata($post); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?></ul><br />
I would like to be able to make it so only 10 show up, and then the next page link comes up, but I am not sure how to do this. I can get it to work for the actual categories page, but I have no clue how to do it on the individual post.
On my archive page I used
<?php $posts = query_posts( $query_string . '&order=ASC&orderby=post_date' ); ?> <?php if( $posts ) : ?> <?php foreach( $posts as $post ) : setup_postdata( $post ); ?> <ul class="nav"><li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> <li><?php posts_nav_link( ' · ', __(' « Previous Page'), __(' Next Page »'), __('') );?></li> <?php endif; ?>
and it came out just how I wanted it. I tried to replicate something on the actual posts template using the new WP_Query thing, but the posts_nav_links link to the wrong page!
How can I create a post template that will list all the posts in the category, and use the next page link like the category page does?
That make sense?
Thank you for all your help.
- The topic ‘Post Pagenation on Post’ is closed to new replies.