So I could see that the query doesn’t bring in custom acf fields into the loop which is fine as I can inject them into the array manually but I can’t figure out how to display them after that.
Params($args) with just a simple filter applied
{
'numberposts' : -1,
'meta_key' : 'my_filter_checkbox',
'meta_value' : '1',
}
Insert my custom acf field (I don’t know if this is the correct way of doing it)
add_filter('cs_looper_custom_getfields', function($result, $args) {
$posts = get_posts( $args );
foreach($posts as $post) {
$post->my_acf_field= get_post_meta(get_the_ID(), 'my_acf_field', true );
}
}, 10, 2);
check debug. Variable is part of post array.
Current Data:
array(5) {
[0]=>
object(WP_Post)#10278 (25) {
...
["post_type"]=>
string(4) "post"
...
["my_acf_field"]=>
string(13) "Some Text Here"
}
...
Then within the looper consumer I would hope to use something like
{{dc:post:my_acf_field}} or
{{dc:post:meta key=“my_acf_field”}}
Am I going about this in the correct way? do I need to provide it in the array in a certain way.
Thanks
Sam