🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
【分页功能】 « 前一页 后一页 » ~~~ previous_posts_link(); next_posts_link(); ~~~ « 前一页 1 2 3 4 下一页 » `echo paginate_links();` ![](https://box.kancloud.cn/594136843ca8963f90964a170247a429_1556x906.png) 或者使用分页插件: WP-PageNavi,下载链接: https://wordpress.org/plugins/wp-pagenavi/ 【自定义搜索分页】 ~~~ <?php $current_page = max(1, get_query_var('paged')); //当前第几页 // //查询参数 // $args = array_filter(array( // 'orderby' => 'title', // 'order' => 'ASC', // 'ignore_sticky_posts' => 1 , // 'posts_per_page' => 9, // 'paged' => $current_page, //当前页 // )); //开始查询 $query = new WP_Query('orderby="title"&order="ASC"&ignore_sticky_posts=1&posts_per_page=12&paged='.$current_page); $total_pages = $query->max_num_pages; //总共多少页 while ($query->have_posts()): $query->the_post(); ?> <div class="col-md-4 col-sm-6 fadeIn wow box-foreach1" data-wow-duration="1.3s"> <a href="<?php the_permalink(); ?>" class="project-item"> <div class="gallery-image"> <?php the_post_thumbnail('product-thumbnails'); ?> </div> <div class="info info-chain"> <div class="h4 title"><?php the_title(); ?></div> <p class="description"><?php the_time('Y年n月j日, G:i:s'); ?></p> <div class="social"> <i class="fa fa-fw fa-eye"></i> 12 </div> </div> </a> </div> <?php endwhile; //输出分页 echo paginate_links( array( 'prev_text' => __( '上一页', 'YChinaTours' ), 'next_text' => __( '下一页', 'YChinaTours' ), 'screen_reader_text' => null, 'total' => $total_pages, //总页数 'current' => $current_page, //当前页数 ) ); ?> ~~~ 参考: https://www.wordpressleaf.com/2018_2258.html