Link to first and last page without a plugin
-
Hi,
Thanks in advance for any advise.
I created a new query to show 12 latest posts of category 1. Code below.
<code> <?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=1&showposts=12&paged=$page"); ?> <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <?php endwhile; ?><?php endif; ?> <?php posts_nav_link('','','Previous Posts') ?> <?php posts_nav_link('','Recent Posts ','') ?> </code>
This works perfectly including the links that shows the next or previous set of 12 posts but what I need to add is a couple of links that links to the first and last set of 12 posts.
I’m aware of the wp-pagenavi plugin of Lester Chan, but it does not fit to what I need to accomplish since I don’t need to show any page numbers in between the first and last links.
Cheers!
- The topic ‘Link to first and last page without a plugin’ is closed to new replies.