I think half the planet that uses WordPress plugin uses PageNavi to offer something better than the typical " Previous Page - Next Page "and the truth is that is fine.
Little does he know that half the planet is that it can provide the same functionality without having to use the plugin ...
And half the planet is what WordPress just does not know is that since version 2.1 of WordPress is a function for exactly the same functionality to offer tickets numbered navigation .
Best of all, it consumes far fewer resources than the PageNavi plugin , and use it only have to do two steps:
1. Create the function
Add this code to your plugin function or file functions.php of your current theme:
//Paginación de entradas
function wp_corenavi() {
global $wp_query, $wp_rewrite;
$pages = '';
$max = $wp_query->max_num_pages;
if (!$current = get_query_var('paged')) $current = 1;
$a['base'] = str_replace(999999999, '%#%', get_pagenum_link(999999999));
$a['total'] = $max;
$a['current'] = $current;
$total = 1; //1 - muestra el texto "Página N de N", 0 - para no mostrar nada
$a['mid_size'] = 5; //cuantos enlaces a mostrar a izquierda y derecha del actual
$a['end_size'] = 1; //cuantos enlaces mostrar al comienzo y al fin
$a['prev_text'] = '« Anterior'; //texto para el enlace "Página siguiente"
$a['next_text'] = 'Siguiente »'; //texto para el enlace "Página anterior"
if ($max > 1) echo '<div class="navigation">';
if ($total == 1 && $max > 1) $pages = '<span class="pages">Página ' . $current . ' de ' . $max . '</span>'."\r\n";
echo $pages . paginate_links($a);
if ($max > 1) echo '</div>';
}
2. Add the function to your theme
Once you save the changes you just add the following code where you want to display the page of entries, usually in the first line of the file footer.php your active theme:
<?php if (function_exists('wp_corenavi')) wp_corenavi(); ?>
Guards new changes and you're done. The resulting HTML function might look like:
<div class="navigation">
<span class="pages">Página 7 de 27</span>
<a class='prev page-numbers' href='http://tusitio.es/page/6/'>« Anterior</a>
<a class='page-numbers' href='http://tusitio.es/page/1/'>1</a>
<span class='page-numbers dots'>...</span>
<a class='page-numbers' href='http://tusitio.es/page/4/'>4</a>
<a class='page-numbers' href='http://tusitio.es/page/5/'>5</a>
<a class='page-numbers' href='http://tusitio.es/page/6/'>6</a>
<span class='page-numbers current'>7</span>
<a class='page-numbers' href='http://tusitio.es/page/8/'>8</a>
<a class='page-numbers' href='http://tusitio.es/page/9/'>9</a>
<a class='page-numbers' href='http://tusitio.es/page/10/'>10</a>
<span class='page-numbers dots'>...</span>
<a class='page-numbers' href='http://tusitio.es/page/27/'>27</a>
<a class='next page-numbers' href='http://tusitio.es/page/8/'>Siguiente »</a>
</div>
All the dots rebonito dividers for your WordPress offers a useful and visually interesting navigation .