where is wordpress search pagination

Where is wordpress search pagination?I used this in my search page:<?php echo paginate_links(); ?>It returns pagin

Where is wordpress search pagination?

I used this in my search page:

<?php echo paginate_links(); ?>

It returns pagination, but I want to add bootstrap pagination to this, but I can't find it. Where is this and how can I add a class?

Where is wordpress search pagination?

I used this in my search page:

<?php echo paginate_links(); ?>

It returns pagination, but I want to add bootstrap pagination to this, but I can't find it. Where is this and how can I add a class?

Share Improve this question edited Jan 15, 2020 at 12:29 TomC 1,3168 silver badges18 bronze badges asked Jan 15, 2020 at 10:45 Jack The BakerJack The Baker 1012 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

The code is in wp-includes/general-template.php.

However there aren't any great options for styling the output: there's a hook for you to modify the link URL, but nothing else. Your best bet might be to call it in type=array mode

$links = pagination_links([ "type" => "array" ]);

which will return you an array of strings of links of the form

<a class="prev page-numbers" href="/page/1/">&laquo; Previous</a>
<a class="page-numbers" href="/page/1/">1</a>
<span aria-current="page" class="page-numbers current">2</span>
<a class="page-numbers" href="/page/3/">3</a>
<a class="next page-numbers" href="/page/3/">Next &raquo;</a>

which you can then process into Bootstrap form:

  1. replace "page-numbers" in the class with "page-link"
  2. convert the current page span into a regular link with class="active" too
  3. wrap each item with in <li class="page-item">...</li>
  4. and then wrap the whole thing in <ul class="pagination>..</ul>.

However it may be simpler to just copy/paste the function into your own code and change the mark-up it generates, rather than trying to unpack and rewrite mark-up after the fact. You potentially lose any future core updates to the function, but I think those are unlikely beyond occasional aria changes.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744834068a4596155.html

相关推荐

  • where is wordpress search pagination

    Where is wordpress search pagination?I used this in my search page:<?php echo paginate_links(); ?>It returns pagin

    2天前
    70

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信