0

I am currently working with the Pods plugin.

I extended the user pod and I added a corporate image field.

On the administration everything is fine, I can change the image of each user.

enter image description here AND :

enter image description here

My problem is that I can not display this image on a front office page..

If i do this : var_dump($pod->field('image_societe')); It return false, while the field name is correct, and for plain text fields, it works.

But i can do this :

var_dump($pod->fields('image_societe'));

This will return me full of information, but I do not have access to the id of the image, it is not present in the information.

I would like to finally be able to do this:

the_attachment_link( 11923 );

Where 11923 is the image's ID.

To be dynamic according to the user, the documentation says that it must be done like this:

the_attachment_link($pod->field('image_societe.ID'));

But as pods return me false, it does not work.

Does someone have an idea ?

Thank you !

Peter Artoung
  • 224
  • 5
  • 20

1 Answers1

1

Usually you can get the image url by querying $pod->field('image_societe.guid'). E.g. :

$items = pods('your_pod', array("limit" => -1));
while($items->fetch()) {
    echo $items->field('image_societe.guid');
}

If $pod->field('image_societe'); doesn't return anything, then something might be wrong with your pod query, or caching kicking in. So more code would be needed to review this.

mastef
  • 2,787
  • 1
  • 6
  • 16