-4
これ以上の投稿があっても10件の投稿結果しか表示されないのはなぜですか?ページに表示される投稿結果の数を変更するには
<div class="job-cont">
\t \t <?php
\t \t $query = new WP_Query(array('post_type' => 'jobs'));
\t \t \t if ($query->have_posts()) :
\t \t \t \t while ($query->have_posts()) : $query->the_post(); ?>
\t \t \t \t <div class="title_image_container">
\t \t \t <a href="<?php the_permalink(); ?>">
\t \t \t <h1 class="the_job_title"><?php the_title(); ?></h1>
\t \t \t <img class="the_job_image" src="<?php the_post_thumbnail();?>
\t \t \t </a>
\t \t \t \t </div>
\t \t \t <?php endwhile;
\t \t \t endif;
\t \t ?>
\t \t
\t \t </div>
それはそこに私がページに示されたことにしたい投稿の数を変更する方法は?
私はすべての準備は、まだこの1を試してみましたが、結果なし:
function number_of_posts_per_page($number) {
if (is_home()) {
$number->set('posts_per_page', 15);
}
add_action('pre_get_posts', 'number_of_posts_per_page');
何ですか?もう少し詳細を書いて、あなたが話していることを知らない – user5014677
はい。申し訳ありません、今、理解することをお勧めします。 – Caesar