I have a CPT called packages. On these holiday package pages, the content is made up of ACF blocks.
One of these contains basic information like, name, location, price etc – as well as a radio button asking if they would like to add a flag that says things like ‘popular’
I have a template which outputs all this into an archive and it works as expected BUT I just can’t get the radio button to work, it doesn’t seem to pick up the value at all and I don’t understand why. It is driving me nuts!
I have done this before with very little effort but for some reason, I just cannot get it to work this time.
If the radio button field called ‘add_flag’ is equal to yes, I want to get the field flag_text which is a text field.
This is what I have
Thanks!
Sheree
<section class="full-width-package-filter full-width-section cream-bg">
<div class="full-width-inner">
<?php
if ( have_posts() ) : ?>
<div class="package-listings">
<div class="listings-table-row">
<?php
while ( have_posts() ) : the_post(); ?>
<div class="package-wrapper teal-bg">
<?php if( get_field('add_flag') == 'yes' ) { ?>
<p><?php the_field( 'flag_text' ); ?></p>
<?php } ?>
<?php if ( has_post_thumbnail() ) : ?>
<div class="package-home-image">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail(); ?>
</a>
</div>
<?php endif; ?>
<div class="home-package-title">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</div>
<div class="home-package-excerpt">
<p class="excerpt"><?php echo $excerpt ?></p>
</div>
<div class="home-package-button orange-bg">
<a href="<?php the_permalink(); ?>"><button>Read More</button></a>
</div>
</div> <!-- package wrapper end -->
<?php endwhile; ?>
</div> <!-- listings table row end -->
<?php
endif; ?>
<?php echo facetwp_display( 'facet', 'large_filter_pagination' );?>
</div> <!-- Package listings end -->
</div>
</section>
You must be logged in to reply to this topic.
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.