Support

Account

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 ?