내 웹 사이트에서 custom_post_type 목록을 표시하는 데 문제가 있습니다. 게시물을 가져올 수 있지만 작동하지 않는 것은 "post_per_page"입니다. 그것은 무시되고 그 유형의 모든 게시물을 얻습니다. 여기 맞춤 Post_per_page가 작동하지 않습니다.
가 내 홈 페이지에있는 코드입니다 (너무 다른 곳에서 작동하지 않습니다) :<?php
// 1ST
$args = array(
'post_type' => 'custom_post_1',
'post_per_page' => 1,
);
$custom_post_1 = new WP_Query($args);
if ($custom_post_1->have_posts()) : while ($custom_post_1->have_posts()) : $custom_post_1->the_post(); ?>
// My content
<?php endwhile; endif; wp_reset_postdata(); ?>
<?php
// 2ND
$args = array(
'post_type' => 'custom_post_2',
'post_per_page' => 3,
);
$custom_post_2 = new WP_Query($args);
if ($custom_post_2->have_posts()) : while ($custom_post_2->have_posts()) : $custom_post_2->the_post(); ?>
// My content
<?php endwhile; endif; wp_reset_postdata(); ?>
<?php
// 3RD
$args = array(
'post_type' => 'custom_post_3',
'post_per_page' => 1,
);
$custom_post_3 = new WP_Query($args);
if ($custom_post_3->have_posts()) : while ($custom_post_3->have_posts()) : $custom_post_3->the_post(); ?>
// My content
<?php endwhile; endif; wp_reset_postdata(); ?>
사전에 감사!
... 정말 감사합니다! –