简体   繁体   中英

Pagination WordPress theme

I'm building my own theme for WordPress, but now I'm stuck because I need add the pagination to the blog post page. I attached HTML code where I want add the PHP code for pagination.

<ul class="justify-content-center">

    <li><a href="#">1</a></li>
    <li class="active"><a href="#">2</a></li>
    <li><a href="#">3</a></li>

</ul>

I'm using the WordPress function "pagination_links", but how can I get each number created inside the "li" tag?

paginate_links() is the function. If you check the WordPress documentation for this function it does mention an argument 'type' which controls format of the returned value. Possible values are 'plain', 'array' and 'list'. Default is 'plain'. For your case function will be as following:

paginate_links(array(
  'type' => 'list'
));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM