| | 10 | I use the paginate_link into a widget : |
| | 11 | |
| | 12 | |
| | 13 | {{{ |
| | 14 | // The Query |
| | 15 | $query = new WP_Query($args); |
| | 16 | // The Loop |
| | 17 | if ($query->have_posts()) { |
| | 18 | while ($query->have_posts()) { |
| | 19 | $query->the_post(); |
| | 20 | .... |
| | 21 | } |
| | 22 | }else{ |
| | 23 | get_template_part( 'content', 'none' ); |
| | 24 | } |
| | 25 | ?> |
| | 26 | <div id="pagination-<?php echo $widget_id?>" class="pagination-mae-list"> |
| | 27 | |
| | 28 | <?php |
| | 29 | if ($current_country != '') |
| | 30 | $format = '?current_country_mae_list-'.$widget_id.'='.$current_country.'&'; |
| | 31 | else |
| | 32 | $format = '?'; |
| | 33 | echo paginate_links(array( |
| | 34 | 'format' => $format.'current_page_mae_list-'.$widget_id.'=%#%', |
| | 35 | 'current' => max(1, $current), |
| | 36 | 'total' => $query->max_num_pages, |
| | 37 | 'end_size' => 3, |
| | 38 | 'mid_size' => 3, |
| | 39 | 'prev_text' => '<< ', |
| | 40 | 'next_text' => '>> ' |
| | 41 | )); |
| | 42 | ?> |
| | 43 | </div> |
| | 44 | |
| | 45 | }}} |
| | 46 | |
| | 47 | |