FIX next_posts_link() & previous_posts_link() ON FIRST AND LAST PAGE


<?php  $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;  ?>

<h1> <?php  $paged; ?></h1>

<?php

global $wp;

$wp_query->max_num_pages; ?>
<li><?php if(get_previous_posts_link()) { previous_posts_link(‘Previous &raquo;’); } else { echo ‘Previous’; } ; ?></a></li>
<li>Page <?php echo $paged; ?> of <?php echo $wp_query->max_num_pages;?> </li>
<li><?php if(get_next_posts_link()) { next_posts_link(‘&laquo; NEXT’); } else { echo ‘Next’; } ; ?></li>
</ul>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s