Login

the_posts_pagination() ——wordpress paging principle

Author:neo yang Time:2023/07/29 Read: 7231


I have never understood the paging principle of wordpress lists. I finally figured it out today.

The list and pagination data of wordpress are written in the global parameter: $wp_query. As long as the queried list data is put into this parameter, you can use the_posts_pagination() or get_the_posts_pagination() to display the pagination. As for the page that appears after clicking the pagination, Don't worry, wordpress has already done it.

Code:

global $wp_query; 

 $wp_query=new WP_Query($arg);

Then, you can use the_posts_pagination() to display pagination under this list.



tags:


copyright © www.lyustu.com all rights reserved.
Theme: TheMoon V3.0. Author:neo yang