<?php
$args = array(
\'post_type\' => \'clients\',
\'post_status\' => \'publish\',
\'tax_query\' => array(
array(
\'taxonomy\' => \'clients_service\',
\'field\' => \'slug\',
\'terms\' => \'therapy\'
)
)
);
$testimonials = new WP_Query( $args );
if( $testimonials->have_posts() ) :
?>
<ul>
<?php
while( $testimonials->have_posts() ) :
$testimonials->the_post();
?>
<li><?php printf( \'%1$s - %2$s\', get_the_title(), get_the_content() ); ?></li>
<?php
endwhile;
wp_reset_postdata();
?>
</ul>
<?php
else :
esc_html_e( \'No clients in the therapy taxonomy!\', \'text-domain\' );
endif;
?>
调用新的WP\\u查询时,将检索相关的客户端,我们可以对它们进行循环。在循环中,我们只需在一个简单的列表中输出客户端的标题和内容。