Paggination

<?php // libs -> utils.php function generate_pagination($paged, $loop){ $big = 999999999; // need an unlikely integer echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, $paged ), // zwraca biezaca strone 'total' => $loop->max_num_pages, 'prev_text' => '<<', 'next_text' => '>>', 'type' => 'list' )); } ?> <div class="pagination"> <?php generate_pagination(get_query_var('paged'),$loop); // $loop - petla z wszystkimi postami ?> </div> Funkcja generuje nastepujaca strukture: <ul> <li><a></a></li> dla linku aktywnego <li><span></span></li> dla linku nie aktywnego </ul>

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.