Hi Traci,
You can retrieve values from ACFs through Dynamic Headlines, however there are limitations. One of them would be arrays.
To address this, One approach is to create a Portable Hook through PHP code:
function your_shortcode($atts, $content = null) {
ob_start();
do_action('hook_name');
return ob_get_clean();
}
add_shortcode('portable_hook', 'your_shortcode');
Now, we can use this portable_hook
in our Content Template as such: https://share.getcloudapp.com/jkuvm5l6
Then, we can retrieve the post meta manually through a Hook Element hooked to hook_name
which is our portable hook: https://share.getcloudapp.com/kpuJ4g4D
An example code would be:
<?php
$relationships = get_post_meta(get_the_id(),'myrelationship',true);
foreach($relationships as $relationship){
echo '<p class=relationships>' . get_the_title($relationship) . '</p>';
}
?>
This code would retrieve all relationships and place them in a p
tag. With this code hooked to our portable_hook
, the specific relationships of your CPT should now appear.
Kindly modify this code to your preference.
Hope this helps! 🙂