Home › Forums › General Issues › Footer conditional field display is not working in blog page and single posts › Reply To: Footer conditional field display is not working in blog page and single posts
The problem is that when you’re in the footer that WP/ACF doesn’t know what post to get the field from. In this case you need to supply the post ID. This is covered in the get_field() documentation http://www.advancedcustomfields.com/resources/get_field/ and this is how you can do that
<?php
$queried_object = get_queried_object();
if( get_field('sub_footer_section', $queried_object->ID) ):
<section class="subfooter">
//with a few of:
the_field('field_name', 'options');
</section>
endif;
?>
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.