Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #28334, comment 7


Ignore:
Timestamp:
05/28/2014 07:45:44 PM (11 years ago)
Author:
nexurium
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28334, comment 7

    initial v1  
    88My first change is not good, but the condition {{{ 2 == $current }}} is not good too. if current is the second page the previous link must be 1 dans not ""
    99
     10I 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