Trying to retrieve multiple pods via pick field, no matching image?

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  redconservatory 2 years, 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #163906

    I am trying to retrieve information from a pods called "related_artists" using:

    So far, so good. I am getting 3 items per array ($episode_artist, $episode_artist_imageID). But when I write:

    The first name, last name, and permalink all correspond to the same artist (good!) but the image is a photo of a totally different artist.

    After looking at the database…it seems like "name" "last name" and "permalink" are all in the same table ("episode") but it looks like pods stores the images elsewhere. Maybe this explains why pulling artist_thumb[0] won’t match firstname[0]?

    Is there any way to make sure that images that are part of a "pod" relate to the corresponding name?

    #163907

    sc0ttkclark
    Keymaster
    Post count: 803

    I’d suggest making a different approach, the current way you are doing it assumes a few things that could change, and the order of the field data returned isn’t always perfect unless you apply a second variable to the get_field(‘field_name’,'id’) to order by id, or you can use ‘name’ too.

    I suggest looping through the related_artists and setting up a new pod like $episode_artist = new Pod(‘artist’,$artist_id); and then utilizing that variable for your artist-related data. Don’t be afraid about performance on a big page, Pods caches these queries so pulling the same artist multiple times won’t bleed you dry.

    #163908

    With Scott’s help, got it working…here’s a bit of the code in case anyone has something similar.

    This loop creates variables named:

    etc

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Wordpress Cloud Hosting