Archived topic
Get contents of custom field associated with featured image
3 replies · Started by Ali on April 15, 2020
Hello,
Thank you for the incredible tool you've created. It is truly powerful!
I have a question about custom fields. From what I understand, they seem to only work for posts? I have featured images that have custom fields associated with them (using Pods plugin). I am trying to display information from the media's custom field in the header on the post page. Is there a way to do that?
Thanks!
Ali
Hi there,
Thanks for the great feedback.
PODs can get a little complicated. Might be worth having a chat with PODs support - their Slack channel is great:
Hi David,
Actually it does not have to do specifically with pods. Here is the solution for anyone who might run into this:
I have extended Media to have extra custom fields so that each featured image can have extra information associated with it. One of my custom fields for Media is called 'media_type' and I am now calling it like this in a hook:
<?php echo get_post(get_post_thumbnail_id())->media_type; ?>
Aah ok - thanks for sharing :)