• Hello,
    I’m having a problem with pagination. Pagination is not working when l activate polylang plugin.

    l read Don’t override query vars with query_posts arguments post in polylang site, but l don’t resolve that.

    My pagination function: (in functions.php)

    function pagination($pages = '', $range = 2)
    {
         $showitems = 2;
    
         global $paged;
         if(empty($paged)) $paged = 1;
    
         if($pages == '')
         {
             global $wp_query;
             $pages = $wp_query->max_num_pages;
             if(!$pages)
             {
                 $pages = 1;
             }
         }
    
         if(1 != $pages)
         {
             echo "<div class=\"pagination\"><span>Sayfa ".$paged." / ".$pages."</span>";
             if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo; İlk</a>";
             if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo; Önceki</a>";
    
             for ($i=1; $i <= $pages; $i++)
             {
                 if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
                 {
                     echo ($paged == $i)? "<span class=\"current\">".$i."</span>":"<a href='".get_pagenum_link($i)."' class=\"inactive\">".$i."</a>";
                 }
             }
    
             if ($paged < $pages && $showitems < $pages) echo "<a href=\"".get_pagenum_link($paged + 1)."\">Sonraki &rsaquo;</a>";
             if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Son &raquo;</a>";
             echo "</div>\n";
         }
    }

    l would be glad if you help.
    Regards.

    https://wordpress.org/plugins/polylang/

The topic ‘Pagination Function Issue with Polylang’ is closed to new replies.