Hello,
I´m trying to build a solution with ACF and need some advise if this solution is possible to build.
I have two custom fields, 1: Custom Format and 2: Custom infotext
1 = Custom format have two options.
2 = Custom infotext is just a textbox that the user can write in
I know how to show the custom infotext value by using get_field and the_field.
<?php if( get_field ('custom_infotext') ) : ?>
<p class="custominfo">
<?php the_field('custom_infotext'); ?>
</p>
<?php endif; ?>
But I want this custom infotext to only by visible if the custom format have the value option2.
How should I do? Can I wrap the code above in a new if-loop or should I use something else?
THANKS!
if you talk about frontend, than place your code inside a if-loop like that:
<?php
$custom_format = get_field('custom_format');
if($custom_format == "option2"){
if( get_field ('custom_infotext') ) : ?>;
<p class="custominfo">
<?php the_field('custom_infotext'); ?>
</p>
<?php endif;
}?>
replace custom_format with your fieldname, and option2 with the value of option2
Awesome! Works like charm! Thanks!
i am glad that i was able to help you.
but i cant read/see your reply, because it is marked as private.
Sorry 🙂 You should see it now.