WP loop is not displaying properly
-
I have created an accordion using checkbox inputs. When I display the post it is only retreiving the forst posts info for every post that it lists.
<h2 class=”faq-h2″><?php the_title(); ?></h2>
<?php $args = array (‘post_type’ => ‘faq’); $the_query = new WP_Query($args); ?>
<?php if ($the_query->have_posts() ) :
while ($the_query->have_posts() ) :
$the_query->the_post(); ?><div class=”half”>
<div class=”tab”>
<input id=”tab” type=”checkbox” name=”tabs”>
<label for=”tab”><?php the_field(‘question’); ?></label>
<div class=”tab-content”><p><?php the_field(‘answer’); ?></p>
</div> <!—- end tab-content—->
</div> <!—- end tab—->
</div> <!—- end half—->
<?php endwhile; endif; ?> `This code displays all the posts but when I click on the relevant checkbox it will only action the first one. I have done the styling in CSS and am having problems with the Loop. Any Help out there.
- The topic ‘WP loop is not displaying properly’ is closed to new replies.