Skip to content

Instantly share code, notes, and snippets.

@ciaranha
Created July 27, 2016 12:12
Show Gist options
  • Save ciaranha/baf3e9f58cfe10f0230d4b209818f4d2 to your computer and use it in GitHub Desktop.
Save ciaranha/baf3e9f58cfe10f0230d4b209818f4d2 to your computer and use it in GitHub Desktop.
bootstrap repetable custom post type
<section>
<h2>FAQ</h2>
<div class="faq-row">
<?php wp_reset_query(); ?>
<?php
$args = array(
'post_type' => 'faq',
'posts_per_page' => -1,
'order' => 'DESC',
'orderby' => 'title',
);
$wp_query = new WP_Query( $args );
if ( $wp_query->have_posts() ) : ?>
<?php $count=0; ?>
<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
<div class="faq">
<h4 class="speaker-name"><?php the_field('speaker_name'); ?></h4>
<h5 class="speaker-topic"><?php the_field('speaker_topic'); ?></h5>
<p><?php the_field('speaker_bio'); ?></p>
<?php if( get_field('speaker_day') ): ?>
<h6 class="speaker-day">Day: <?php the_field('speaker_day'); ?></h6>
<?php endif; ?>
<?php if( get_field('speaker_facebook_link') ): ?>
<a href="<?php the_field('speaker_facebook_link'); ?>" target="_blank">
<i class="fa fa-facebook"></i>
</a>
<?php endif; ?>
<?php if( get_field('speaker_twitter_link') ): ?>
<a href="<?php the_field('speaker_twitter_link'); ?>" target="_blank">
<i class="fa fa-twitter"></i>
</a>
<?php endif; ?>
</div>
<?php $count++; ?>
<?php if ($count==2 ||$wp_query->found_posts==0) :
echo '</div><div class="faq-row">';
?>
<?php $count=0; ?>
<?php endif; ?>
<?php endwhile; ?>
<?php else : ?>
Still have questions?
<a href="http://help.visible.vc/10985-FAQ">Visit or FAQ page</a>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div><!-- end row-->
<div class="faq">
<div class="faq-q">
</div>
<div class="faq-a">
</div>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment