Skip Navigation

[Resolved] Displaying related parent post on dynamic page

This support ticket is created 4 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 9 replies, has 2 voices.

Last updated by JamesS2731 4 years, 10 months ago.

Assisted by: Shane.

Author
Posts
#1535679

Tell us what you are trying to do?

Display a members club on a dynamic page (/my-profile/).

Riders and Clubs are custom post types and I have set a one to many relationship (with clubs as parent and riders as child).

This works fine on an individual Riders page (ie. hidden link) but doesn't work on the dynamic page I've created for them to redirect to after login (i.e. hidden link).

Is there a way to achieve this? If not, is there a way to redirect a Rider to the individual rider page rather than a my-profile page?

Is there any documentation that you are following? Yes, quite a few of the help topics.

Is there a similar example that we can see? Only the current setup - hidden link

What is the link to your site? hidden link

I look forward to any thoughts or advice.

Kind Regards
James

#1535835

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi James,

Thank you for getting in touch.

How is the profile page generated? Is it based on the user's ID?

Also when you go to the profile page that will list the rider information. Is the user who is logged in the author of the Rider post that they want to display ?

Please let me know.
Thanks,
Shane

#1536037

Hi Shane,

Many thanks for the quick response.

I’m just using a content template and calling the user fields (wpv-user-field). Is there a better way of calling the information?

Kind regards
James

#1536281

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

iI James,

That is actually fine.

So what you want to do now is to filter the view that is listing the post by the currently logged in user correct? This is because you want to list out the posts that the current user created correct ?

Please let me know.

Thanks,
Shane

#1536419

Hi Shane,

Yes, that's correct.

I've tried filtering them in a view using the post relationship query filter, then choosing the relationship as related items of both 'The post where this View is shown' and ' The current post in the loop'.

I've also then tried choosing the post selection on the field to be displayed (Post Title with link) and then, again, choosing the post relationship. [wpv-post-link item="@club-rider.parent"]

I've even tried with no filter, but am not getting any clubs listed.

Finally, I tried adding a post relationship directly into the content template, as it's only showing one result, as follows:

{!{wpv-post-link item='@club-rider.parent'}!}

Kind regards
James

#1539419

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi James,

What you need to do is to add the filter to the view for the Post Author.

Then set that filter to the current logged in user. This will set the view to list out the post of the user that is currently logged in.

If this still doesn't work please let me know and provide me with a test login for a user that has created some posts that you want to display.

Thanks,
Shane

#1542127

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2020-03-06 at 9.43.00 AM.png
Screenshot 2020-03-06 at 9.41.38 AM.png

Hi James,

Ok so I took a look at this for you. However for 100% clarity you want to list out the clubs that the riders are apart of on their individual profiles using views correct?

I went ahead and set up the post relation on the view. The filter that was required was a Post Relationship filter. See Screenshot

You should now be able to see the clubs the riders are involved in. I've added a simple test of the view to the profile and you should see the name listed at the bottom of the page. See Screenshot

Please let me know if everything is ok now.

Thanks,
Shane

#1542201

Hi Shane, many thanks for looking into this.

You have indeed got it working on the Rider public profile page (i.e. hidden link ) but it always worked there (if you look up the page, it's in the first block to the right of the rider image).

My issue has been to get it to work on the riders private profile page (hidden link).

Sorry for the confusion. I created you a public profile so that you could see the difference in display (one working, one not).

Is there anything you can recommend to get ti to display on the /my-profile/ page?

Kind Regards
James

#1542241

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi James,

Ok thanks for the clarity, so you will need to create a nested view setup.

The first view will list out the current logged in user's profile. So this view will have a query filter for the Post Author and set it to the currently logged in user.

Now the 2nd view will be the exact same as your my-club link view with the same query filter that i've added, however instead of having the relationship filter set to "Post where view is shown" you will need to set it to "the current post in the loop".

This will ensure that your post relationship filter will pick up the profile of the user who is currently logged in.

Finally just add the 2nd view into the first view inside the <wpv-loop></wpv-loop> tags and from there just add your first view to the My-Profile page.

Thanks,
Shane

#1545077

Yep, thats perfect. All working now. Many thanks for all your help Shane!

Kind regards
James