Skip Navigation

[Resolved] Related posts aren’t showing in my View

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a View with a post relationship filter, but related posts aren't being displayed as expected. The View is placed in the post content of the parent post type, which is then displayed in an Essential Grid.

Solution: Set the post relationship filter to respond to a shortcode attribute "wpvrelatedto", and place the post ID in the View shortcode attribute "wpvrelatedto".

[wpv-view name="team-member-article" wpvrelatedto="12345"]

Relevant Documentation:
@https://toolset.com/documentation/user-guides/passing-arguments-to-views/

This support ticket is created 6 years, 5 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by Judith Sparks 6 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#1087572
Screen-Shot-2018-08-20-at-12.06.45-PM.jpg
Screen Shot 2018-08-20 at 12.05.14 PM.png
Screen Shot 2018-08-20 at 12.05.07 PM.png
Screen Shot 2018-08-20 at 12.04.55 PM.png
Screen Shot 2018-08-20 at 12.04.24 PM.png

I am trying to: apply a connected post to show in a view that is placed in the post content through a shortcode to show in the frontend of the site.

Link to a page where the issue can be seen: hidden link
It's in the lightbox for the team members
I expected to see: The post link that was selected in the admin area as a selection under recent article.

Instead, I got: Right now it is showing the first post created and not the connected post for all the team members. I was able to get views and post relationships to work well on other parts of the site. So I'm wondering if it is because of the placement of the views shortcode.

#1087766

Hi, it looks like your Query Filter is set to look for Posts related to a Team Member, based on the post where this View is shown. The problem is that the View isn't shown on a Team Member post in this example - it's shown on a Page called "How we can help". So the filter reference point isn't exactly right. Change the View's Query Filter to respond to a shortcode attribute wpvrelatedto instead of post where this View is shown. Then pass the Team Member's numeric ID into the View using a shortcode attribute, like this:

[wpv-view name="team-member-article" wpvrelatedto="12345"]

Change 12345 to match the Team Member's numeric ID. Make this adjustment to the View shortcode in each Team Member's post. Now regardless of whether the View is shown on the custom page "How we can help" or on the Team Member single post, the query filter reference will be accurate. This technique is called passing arguments into a View, and is described in more detail here: https://toolset.com/documentation/user-guides/passing-arguments-to-views/

#1090248

Thanks, Christian,

That worked!