Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post Thumbnail not returned on Parent Entity #3779

Closed
garypaul opened this issue Sep 8, 2016 · 7 comments
Closed

Post Thumbnail not returned on Parent Entity #3779

garypaul opened this issue Sep 8, 2016 · 7 comments

Comments

@garypaul
Copy link
Contributor

garypaul commented Sep 8, 2016

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}
@quasel
Copy link
Member

quasel commented Sep 9, 2016

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 ^^

@quasel
Copy link
Member

quasel commented Sep 6, 2017

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

@jimtrue
Copy link
Contributor

jimtrue commented Sep 6, 2017

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.

@pglewis pglewis self-assigned this Sep 8, 2017
@quasel quasel assigned pglewis and unassigned pglewis Sep 8, 2017
@quasel
Copy link
Member

quasel commented Sep 8, 2017

Workaround from jim - use multiple select and limit to 1

@pglewis pglewis assigned jimtrue and unassigned pglewis Oct 5, 2017
@jimtrue
Copy link
Contributor

jimtrue commented Oct 5, 2017

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.

@jimtrue jimtrue assigned pglewis and unassigned jimtrue Oct 5, 2017
@jimtrue jimtrue modified the milestones: Pods 2.7, Pods 2.7.1 Oct 5, 2017
@sc0ttkclark sc0ttkclark modified the milestones: Pods 2.7.1, Pods 2.7.2 Dec 7, 2017
@pglewis pglewis modified the milestones: Pods 2.7.2, Pods 2.7.3, Pods 2.7.4 May 2, 2018
@pglewis pglewis modified the milestones: Pods 2.7.4, Pods 2.7.5, Pods 2.7.6 Jun 6, 2018
@jimtrue jimtrue modified the milestones: Pods 2.7.6, Pods 2.7.7 Jun 8, 2018
@quasel
Copy link
Member

quasel commented Jul 16, 2018

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

@JoryHogeveen
Copy link
Member

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants