[Resolved] Get contents of custom field associated with featured image

Home Forums Support Get contents of custom field associated with featured image

  • This topic has 3 replies, 2 voices, and was last updated 6 months ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1240819
    Ali

    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

    #1241349
    David
    Staff
    Customer Support

    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:

    https://pods.io/support/

    #1241444
    Ali

    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; ?>

    #1241708
    David
    Staff
    Customer Support

    Aah ok – thanks for sharing 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.