Dynamic Content - Portfolio Single

Hello - I’m wondering if there is a way to pull Image Title, Caption, and Description into Text on a Custom Portfolio Single Page that I’m building. I tried using this in a text element but it doesn’t seem to work: {{dc:post:featured_image_caption}}

Is there a way to do this?

Hello @noizepro,

Thanks for writing to us.

I would suggest you please have a look at this thread to learn more about how to display the featured image alt text.

Hope it helps
Thanks

Thank you. I was able to alter that to display the image caption. I’ll display the code that I used for reference for anyone else looking to do this.

// Use: {{dc:postcaption}}
add_filter( 'cs_dynamic_content_postcaption', function( $result, $field, $args) {
$image_id = get_post_thumbnail_id(get_the_ID(), 'postcaption');
$attachment = get_post($image_id);  
$result = $attachment->post_excerpt; // Retrieve the caption
return $result;
}, 10, 3 );

Hello @noizepro,

I am glad that you were able to take reference from the above thread code and edit the code as per your requirement, Thanks for sharing the information it might be helpful for others as well.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.