亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

請幫助我了解此 php sneppet 上 <li> 的限制

請幫助我了解此 php sneppet 上 <li> 的限制

PHP
慕標5832272 2023-09-15 17:39:31
我用這個片段來顯示故事的章節。但不知道為什么,它是有限的,只顯示10個項目。我無法解決這個問題。請你幫助我,伙計。global $post;       $args = array(        'post_type'   => 'story',        'post_status' => 'publish',        'order' => 'ASC',        'post_parent'    => $post->ID    );    $story = new WP_Query( $args );    if( $story->have_posts() ) : ?>            <div class="story__main">            <h2 class="story__title-chapter">Danh sách các ch??ng</h2>            <ul class="story__chapter">            <?php              while( $story->have_posts() ) :                $story->the_post();?>                <li>                  <a href=<?php echo the_permalink();?>><?php echo get_the_title();?></a>                  </li>                  <?php endwhile;?>                    </ul>                    </div>                    <?php endif;
查看完整描述

1 回答

?
森欄

TA貢獻1810條經驗 獲得超5個贊

嘗試設置該posts_per_page值。


$args = array(

        'post_type'   => 'story',

        'post_status' => 'publish',

        'order' => 'ASC',

        'post_parent'    => $post->ID,

        'posts_per_page' => -1

    );

重要提示:這可能會導致非常大的查詢,從而導致站點癱瘓。僅當您確定您的數據庫可以處理它時才執行此操作。不在公共主題或插件中。


參考


https://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters


查看完整回答
反對 回復 2023-09-15
  • 1 回答
  • 0 關注
  • 144 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號