dongtan8532 2018-12-18 01:34 采纳率: 0%
浏览 23

wp分页没有加载所有页面

I have a site with 2 post types and I implemented wp-pagination plugin, its working well on archive pages, but its not working when inserted it on a template file called page-products. This page displays all posts of both post-types, I have been able to do it so far, but cant display the pagination, even if I force it by plugin settings it will only display 1 page, although I got more then 50 posts. What is wrong with my code?

<div class="inner_cont">
                    <div class="content">
                        <ul class="artlist">
                            <?php
                                    $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
                                    $ppp = 16;

                                    $query_args = array(
                                        'paged' => $paged,
                                        'post_type' => array('product_gold', 'product_tool'),
                                        'posts_per_page' => $ppp,
                                    );


                                    $query = new WP_Query( $query_args );
                                    if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();
                                    $thumbnail = wp_get_attachment_url(get_post_thumbnail_id($post->ID), 'gallery-thumb');
                                    if(empty($thumbnail)) $thumbnail = APP_URL . "images/cms/no-image.png";
                                ?>
                            <li>
                                <a href="<?php echo get_permalink(); ?>">
                                    <div class="img" style="background-image: url(<?php echo $thumbnail; ?>);">
                                        <img src="<?php echo APP_URL ?>images/top/mask_sp.png" alt="" class="mask">
                                    </div>
                                    <!-- .img -->
                                    <div class="text">
                                        <h3 class="tittle pc"><span class="number"><?php echo the_field('b-number'); ?> </span><?php echo mb_strimwidth(get_the_title(), 0, 25, '...'); ?></h3>
                                        <h3 class="tittle sp excpt"><span class="number"><?php echo the_field('b-number'); ?> </span><br><?php echo mb_strimwidth(get_the_title(), 0, 18, '...'); ?></h3>
                                        <h3 class="tittle sp ip5"><span class="number"><?php echo the_field('b-number'); ?> </span><br><?php echo mb_strimwidth(get_the_title(), 0, 15, '...'); ?></h3>
                                        <div class="down">
                                            <div class="dd">
                                                <p class="price"><?php echo the_field('a-price'); ?><?php echo the_field('b-price'); ?> $<span class="smalls">taxes</span></p>
                                                <span class="more pc">read</span>
                                                <span class="more sp">read more</span>
                                            </div>
                                        </div>
                                    </div>
                                </a>
                            </li>
                            <?php endwhile; ?>
                        </ul>

                    </div>

                </div>
                <div class="navw lst sp">
                    <ul class="subnav">
                        <li><a href="<?php echo APP_URL; ?>product/">すべての商品</a></li>
                        <li><a href="<?php echo APP_URL; ?>product_gold/">天然金</a></li>
                        <li class="pres"><a href="<?php echo APP_URL; ?>product_tool/">砂金採掘道具</a></li>
                    </ul>
                </div>
                <?php include($path.'libs/pagination.php'); ?>
                <?php endif; ?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 高缺失率数据如何选择填充方式
    • ¥50 potsgresql15备份问题
    • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
    • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
    • ¥60 pb数据库修改与连接
    • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
    • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
    • ¥20 神经网络Sequential name=sequential, built=False
    • ¥16 Qphython 用xlrd读取excel报错
    • ¥15 单片机学习顺序问题!!