Support

Account

Home Forums Add-ons Flexible Content Field CPT in Flexible Content Reply To: CPT in Flexible Content

  • I’ve figured it out 🙂
    In my main template

    // Question and Answer section
    if( get_row_layout() == 'questions_and_answers_section' )
    get_template_part('partials/stripe', 'questionandanswer');
    

    In my Partials

    <section class="section-white qandasection">
                   <div class="container">
                        <div class="row">
            
                         <div class="col-md-8 col-md-offset-2 st-accordion">
    
    						 <h3>General Questions & Answers</h3>
                <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
                              <?php
             $the_query = new WP_Query(array(
              'post_type' =>'question_answer'
             ));
             while ( $the_query->have_posts() ) :
             $the_query->the_post();
    		 $post = $post->ID
    
             ?>  
                  <div class="well-default panel panel-default">
                    <div class="panel-heading" role="tab" id="headingOne">
                      <h3 class="panel-title"> <a role="button" data-toggle="collapse" data-parent="#accordion" href="#<? the_ID(); ?>" aria-expanded="true" aria-controls="collapseOne" class="collapsed"><?php echo the_field('question'); ?></a> </h3>
                    </div>
                    <div id="<? the_ID(); ?>" class="panel-collapse collapse inn" role="tabpanel" aria-labelledby="headingOne" aria-expanded="true">
                      <div class="panel-body">
                        <?php echo the_field ('answer'); ?>
                      </div>
                    </div>
                  </div>
                 <?php endwhile; wp_reset_postdata(); ?>  
                
                </div>
              </div>
              
    		</div>
    	</div>
    </section>

    And my field is a true/false field within a flexible content field.

    Hope it helps someone else 🙂