hi,
I have added in my function.php this line:
function demo_function( $content ) {
$someHtml = '<div class="someClass" style="color:red;">';
$someHtml .= 'HEADER TEXT';
$someHtml .= get_field('location');
$someHtml .= get_field('description');
$someHtml .= 'FOOTER TEXT';
$someHtml .= '</div>';
$filteredcontent = $someHtml . $content;
return $filteredcontent;
}
add_filter( 'the_content', 'demo_function' );
but it not send value in custom feild. only send HEADER TEXT + FOOTER TEXT. How to fix it?
Thank,
Tommy
Hi @nhatrangart
If the get_field function is not returning data, it is most likely that ACF does not know which post to load the data from.
Can you please debug the value of get_the_ID()
within your demo_function?
Is this ID the expected post’s ID?
Thanks
E