Home › Forums › ACF PRO › Get field block in footer › Reply To: Get field block in footer
Thanks for the answer 🙂
Yes it is, I just checked
Just move my fields into another group but same problem.
This is the new code in footer.php:
<?php $postID = get_the_ID();
$parametres = get_field('parametres', $postID);
$imageSliderOpacity = $parametres['opacity'];
$imageSliderSpeed = $parametres['slider_speed'];
echo $imageSliderOpacity; // returning nothing
echo $postID; // returning 260 it's the correct post ID
?>
<script>
jQuery(document).ready(function($){
$('.slider').slick({
slidesToShow: 1,
slidesToScroll: 1,
dots: true,
arrows: false,
focusOnSelect: true,
fade: true,
autoplay: true
});
var opacitySlider = '<?php echo $imageSliderOpacity ?>';
$('.slick-track').css( "opacity", opacitySlider);
});
</script>
In my template block the same values (without the postID in the get_field) are working, but not in the footer.
Can we use may be the key block in the get_field rather than post id, if yes how ?
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.