안녕하세요. 고급 맞춤 입력란을 사용하여 고객 후기가있는 루프가 있습니다. 루프를 루프를 한 번에 하나의 게시물을 무작위로 내가 query_posts 시도했지만 그 doest 작업이 필요합니다. while 루프에 문제가있다루프의 게시물 제한
<?php
query_posts('posts_per_page=1&orderby=rand');
if(get_field('testimonials', 'options')): ?>
<?php while(has_sub_field('testimonials', 'options')): ?>
<ul>
<li class="title"><?php the_sub_field('name'); ?></li>
<li class="site"><a href="<?php the_sub_field('website'); ?>" target="_blank"><?php the_sub_field('website'); ?></a></li>
<li class="desc"><?php the_sub_field('message'); ?></li>
</ul>
<?php endwhile; ?>
<?php endif; ?>
당신이 http://wordpress.stackexchange.com/ 봤어 발견? – Prix
while 루프는 내가 볼 수있는 query_posts 객체를 사용하지 않습니다. WP_Query : https://codex.wordpress.org/Class_Reference/WP_Query에 대해 읽어보십시오. 필터링을위한 매개 변수가 훨씬 더 많습니다. –
while 루프에서'break;'할 수 있습니다. – Popnoodles