Paginação no Wordpress sem plugin

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();

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.