• Resolved berttervoert

    (@berttervoert)


    Hi,
    I’ve created a pod (fietsroutes agenda) with a relationship to another pod (fietsroutes). Using your tutorial on getting values from a relationship field I managed to get data, but still have one problem:

    I need to display an image that is stored in ‘fietsroutes’ (fieldname=routekaart fieldtype=file/image/video) but can’t get that to work. I use a custom php template. I found examples for pods templates or featured image, but not for an image that is stored as file/image/video.
    I’m using get_post_meta() to get the data from the relationship fields. Could you point me in the right direction for the image?

    Thanks in advance,
    Bert.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter berttervoert

    (@berttervoert)

    After some further reading and trial and error, I managed to display the image from the related pod. I used the following lines of code:

    $wdtv_kaartje_array  = get_post_meta( $wdtv_id, 'routekaart', true );
    $wdtv_kaartje = $wdtv_kaartje_array["guid"];

    But I read somewhere that ‘guid’ may not the best solution for this. Is this true, and if so, what is the correct way to go about it?

    Now I’m struggling with another problem I haven’t been able to solve: I want the displayed title of the ‘fietsroute agenda’ pod to be a link to the related post, so it will go to the page that shows the details of the related ‘route’.

    Thanks in advance,
    Bert.

    Thread Starter berttervoert

    (@berttervoert)

    I think I solved the image part, using the following line of code:

    $wdtv_kaartje = get_post_meta( $wdtv_id, 'routekaart._src', true );

    But how to get the link to the related post is still a problem to me, so if you could help me with that, I would be gratefull.

    Bert

    Thread Starter berttervoert

    (@berttervoert)

    I’ll start a new thread for the link question and set this one as resolved.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to get image from relationship field?’ is closed to new replies.