最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

wp query - Pagination unique to a widget

programmeradmin4浏览0评论

I am having troubles with pagination. It's widget. Every widget does have unique id . Say i have two widgets with pagination. If I cick page 2 of widget 2 then it will work but it will change the pagination of first one too.

$paged_id = $this->get_id();
$paged_query_var = 'paged'.$paged_id;
//var_dump($paged_id);
$paged_bottom = (get_query_var($paged_query_var)) ? absint(get_query_var($paged_query_var)) : 1;
$paged_bottom_args  = array(
  'format'    => '?paged'.$paged_id.'=%#%',
  'current'   => intval($paged_bottom),
  'total'     => intval($query->max_num_pages),
  'mid_size'  => $pagination_midsize,
  'prev_text' => '<i class="fa fa-arrow-left"></i>',
  'next_text' => '<i class="fa fa-arrow-right"></i>',
);
echo paginate_links($paged_bottom_args);

this is what i tried but it does not work as get_query_var will not have variable in it. This is some thing dynamic so i am not able to set the variable for get_query_var using the filter.

Is there any way?

发布评论

评论列表(0)

  1. 暂无评论