Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ACF Group field not displaying on the front end

I have created a group field in ACF to display on posts, pages and custom post type. Please see below screenshots.

enter image description here enter image description here

And here's the code I'm trying for front-end.

 <?php $footerCTA = get_field('footer_cta');
 echo $footerCTA['title']; ?>

The code above doesn't output anything on the front-end. Am I missing here something?

Thanks.

like image 684
shutupchigo Avatar asked Sep 13 '25 19:09

shutupchigo


1 Answers

try this:

if( have_rows('footer_cta') ):

while( have_rows('footer_cta') ) : the_row(); 

    ?>
    <p><?php the_sub_field('title'); ?></p>
    <?php

endwhile;

endif;

?>

like image 161
Khalil DaNish Avatar answered Sep 16 '25 14:09

Khalil DaNish