How would you implement this inside a custom post type loop? I keep getting null for any ACF values from the custom gutenberg block.
Can you please give more details about how you did that?
I’m just pulling in content like images and text into the php page template. For example:
<li class="slide"">
<img src="<?php the_sub_field('client_img'); ?>">
<div class="copy">
<p><?php the_sub_field('client_testimonial'); ?></p>
<div class="author">- <span class="name"><?php the_sub_field('client_name'); ?></span>, <span class="title"><?php the_sub_field('client_title'); ?></span>
</div>
</div>
</li>
That part is working fine. It’s just that at the time that my JS runs, it only sees the HTML and not the actual field values.
Thanks for responding. Yes, all of my code is already wrapped in a document ready function as you suggested. For some reason, the content is still not always loaded when my script runs. Is there a way to ensure that the ACF plugin is loaded before my script?
I had the “Warning: Cannot modify header information” error and I was able to fix this issue by removing extra white space at the end of the file (after the closing tag <?> )
Followed the steps left by user CoolRunLT: https://wordpress.org/support/topic/warning-cannot-modify-header-information-headers-already-sent-15
Not sure if this is the same problem but I hope it helps someone!
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.