我想隐藏使用while循环扩展一张卡片时扩展的其他卡片元素主体吗?因为在while循环中,所有其他卡片元素都具有相同的data-parent标签,所以让我感到困惑。我无法解决此问题,请帮帮我吗?
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 testimonial_section fd">
<h2>FREQUENTLY ASKED QUESTIONS</h2>
<p class="testimonial_fqs_border"></p>
<?php
// The Query
$arg= array(
'post_type'=>'faqs',
'post_status'=>'publish',
'post_per_page'=>6,
);
$the_query = new WP_Query( $arg );
// The Loop
if ( $the_query->have_posts() ) {
$i=1;
while ( $the_query->have_posts() ) {
$the_query->the_post();?>
<div class="card faqs_card">
<div class="card-header faqs_header">
<ul class="card_faqs_ul">
<li class="cards_plus_sign cat_header_holder collapse in" data-toggle="collapse" data-target="#demo<?php echo$i?>"><b>+</b></li>
<li class="card_faqs_heading"><b><?php echo the_title();?></b></li>
</ul>
<!-- <button data-toggle="collapse" data-target="#demo">+</button> --></div>
<div class="card-body cv_group collapse" id="demo<?php echo$i?>">
<?php echo the_content();?>
</div>
</div>
<?php $i++;}
/* Restore original Post Data */
wp_reset_postdata();
} else {
// no posts found
}?>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('.cat_header_holder').click(function() {
$(this).nextUntil('.cat_header_holder').slideToggle('slow');
});
});
</script>