Paginação no WordPress sem uso de plug-in
Postado em 18 de novembro de 2011 por Henderson | Categorias: Úteis | Tags: Paginação | 1 Comentário » | Comentar
Coloque o código abaixo no arquivo functions.php do seu tema:////////////////////////////////////////////////////////////////////////// /// FUNCAO PARA FAZER PAGINAÇÃO ///// //////////////////////////////////////////////////////////////////////// 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 - display the text "Page N of N", 0 - not display $a['mid_size'] = 5; //how many links to show on the left and right of the current $a['end_size'] = 1; //how many links to show in the beginning and end $a['prev_text'] = '« Anterior'; //text of the "Previous page" link $a['next_text'] = 'Próxima »'; //text of the "Next page" link if ($max > 1) echo '<div>'; if ($total == 1 && $max > 1) $pages = '<span>Página ' . $current . ' de ' . $max . '</span>'."\r\n"; echo $pages . paginate_links($a); if ($max > 1) echo '</div>'; }Para ativar a função nas páginas que devem entrar a páginação coloque o código abaixo:
if (function_exists('wp_corenavi')) wp_corenavi();
Tem que usar o também. Muito bom! Um plugin a menos.