我正在浏览一些书籍,以获得带有高级自定义字段的自定义帖子类型。其中一个ACF是复选框,我只想显示选中此复选框的值。我使用的当前回路是:
<?php
$args = array (
\'post_type\' => \'book\',
\'posts_per_page\' => \'2\'
);
$thequery = new WP_Query( $args );
?>
<?php if (have_posts()) : while ( $thequery->have_posts() ) : $thequery->the_post(); ?>
<?php if( get_field(\'book_featured\') ): ?>
<div class="sidebar-book-header">
<img src="<?php the_field( \'book_cover\' ); ?>" alt="">
<a href="<?php the_field( \'buy_now_amazon\' ); ?>" class="sidebar-button book-button" style="background-color: <?php the_field( \'book_color_highlight\' ); ?>" target="_blank"><span>Buy<br>Now</span></a>
</div>
<p class="sidebar-book-info"><?php the_field( \'book_excerpt\' ); ?> <a href="<?php the_permalink(); ?>" style="color: <?php the_field( \'book_color_highlight\' ); ?>">Read More.</a></p>
<?php endif; ?>
<?php endwhile; endif; ?>
这将显示第一个值,但不包括第二个值(我已经检查了两个)。我做错了什么导致循环只显示一个?