Pods: Post Thumbnail not returned on Parent Entity

Created on 8 Sep 2016  ·  7Comments  ·  Source: pods-framework/pods

When you create a 1:M relationship and are in the child entity, you can't seem to access the parent's post_thumbnail property.

Example.
Two pods. Department ( parent ) and test_person ( children )
Create the department with a featured Image and a relationship with test_person

1_department_pod_edit
2_department_pod_saved
3_test_department_editing

Create the test_person with a link to department

4_test_person_pod
5_test_person_editing

Create the template to display a single test_person

6_test_template_2_autocomplete
7_test_template_1

The featured Image of the department doesn't show up. (ToT) 👎

8_template_output

If you noticed, it doesn't show up in the reference or autocomplete either, which is potentially where the issue is.

Temporary fix would be... don't use Featured Image and add an Image field... though post_thumbnail is such an integral part of the whole WP ecosystem that it seems silly to not support that.

Is it possible that this was done intentionally to avoid an extra database table join?

Here's the template code I used:

<h1>{@post_title}</h1>

<p>Department Image Path: 
    {@department.post_thumbnail}
    {@department.post_thumbnail_url}
    {@department.post_thumbnail.thumbnail}
    {@department.post_thumbnail.medium}
</p>

{@post_content}
TemplateMagic Tags Need Research Reproduced Bug

All 7 comments

you could try

[each department]
    {@post_thumbnail.url}
[/each]

which works for me all to well i got the image 24 times :P i rarely use the templates maybe i have time later on to dig deeper or somebody else jumps in ^^

That's still an issue - traversal is broken for any related pod like ( 1:M and 1:1 and n:m )
related_pod.post_thumbnail or
related_pod.post_thumbnail.ID

Related Pods (multiple select) work in an [each related]{@post_thumbnail}[/each] block, so this is strictly limited to the traversal of post_thumbnail helper in traversals.

Workaround from jim - use multiple select and limit to 1

I can confirm this is an issue, even with Pods 2.7 RC1. The Template reference doesn't appear to extrapolate _anything_ from the single select relationship, but single_relationship.post_title outputs properly but the single_relationship.post_thumbnail doesn't.

ran into this again :/ it surfaced twice for the BB Integration!

book_author relationship field to another CPT 1:m -> 3 related items bidirectional assigned!

portrait is a single select image! would expect both to work the same - weird it returns always a string for the first image and nothing for the rest

bildschirmfoto 2018-07-16 um 18 39 09 pm

@quasel
To reply on your last comment.
Traversal over multiple selects simple isn't (and shouldn't be) possible like that.
At least not for magic tags...

The actual issue of this topic is fixed in #5610

Was this page helpful?
0 / 5 - 0 ratings