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 🙂
So – at the moment I’m using:
1. A colour Picker field
2. <div class=”section-space” style=”background-color:<?php the_sub_field(‘colour’); ?>”> In my template
I don’t like the idea of using inline style. Also – I’d like to make the process of adding colour easier for my client. Currently I would have to tell them what #hex colours to use – not a great idea.
So any improvements would be great. I’m thinking of a select for colours options perhaps?.
It’s all good – I’ve fixed it – turns out I had a typo in my echo of the field! So – in case anyone else reads this looking for the solution – adding add_filter(‘acf/load_value’, ‘eae_encode_emails’); to my functions did work.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.