Skip Navigation

[Resolved] Cannot display related posts in the block editor

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

Problem: The post parent filter isn't working as expected in the Block Editor.

Solution: Use the post relationship filter to filter by Types relationships. The post parent filter is for Wordpress hierarchical post types, like Pages.

This support ticket is created 4 years, 11 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 6 replies, has 2 voices.

Last updated by RensV5812 4 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1436511
brother2.png
brother1.png

Another one I don't get. I'm trying to display brother posts in a template but I came across this quirk. When adding a query filter I get the message that nothing is selected in the Content Selection section but clearly there is. Because of this I'm getting the wrong output in the backend and 'No items found' in the front end... In the second screencap you can see the way I set up the query filter.

Rens

#1442943

Okay thanks for the report. I'm not able to replicate this in a quick test on my local environment, so I checked in wp-admin on your site to see if I can figure out what is happening. I assume you are editing this Content Template: hidden link
Is this correct? If so, I do not see the problem here. I am attaching a screenshot showing what I see. The Vacatures post type is selected, and I do not see the warning message "There is no post type selected in the Content Selection section". Are there some other steps I need to take to see the problem? Please provide more details here.

#1444231
Parentpost issue.png

Hi Christian,

Yep that's the content template I am editing. I want to show brother posts in the bottom view in the right side bar on this page.

I just checked and the issue only occurs when selecting query filter 'bovenliggend element' which I believe is the Dutch naming for 'parent post'. In the attached screenshot you can see the selected option. Selecting other filter options in this list does not result in the error prompt.

Thanks,
Rens

#1444747

Okay thank you I see the problem. It is important to understand the difference between Toolset's Post Relationships and WordPress hierarchical post types. The Query Filter Berichtrelatie of eigenaar herhaalbare veldgroepen should be selected to filter using Toolset's Post Relationships feature. The Bericht bovenliggend element filter does not work with Toolset's Post Relationships. The bovenliggend (post parent) Query Filter is only useful with hierarchical post types, like WordPress Pages. In a WordPress hierarchical post type like Pages, one Page can be the parent of another Page. The "bovenliggend element" filter can be used to filter by these hierarhical post parents, but it cannot be used to filter by Toolset's post relationship post parents. If you want to filter by Toolset's Post Relationship parents, use the Berichtrelatie of eigenaar harhaalbare veldgroepen filter. I hope this helps clarify.

#1448691
Parentpost issue2.png

Okay, I've selected the Berichtrelatie query filter now. How do I set it up correctly to display brother posts? I have tried using this shortcode in the 'set with shortcode' option:

[wpv-post-url id="$parent"]

The attribute only allows for lowercase letters and number though.

Thanks again,
Rens

#1448919

Hi, there's not currently a way to pass a shortcode attribute into a View constructed in the Block Editor. Normally, you would use a shortcode attribute like "wpvrelatedto", then pass the parent post's ID into a shortcode attribute like this:

[wpv-view name="Your View Name" wpvrelatedto="[wpv-post-id item='@relationship-slug.parent']"]

However, since the View is constructed in the Block Editor there isn't a way to achieve what you want. I recommend building the View separately, then including it in the Block Editor in a text block instead of a View block. You will be able to add the shortcode attribute here.

#1448923

Okay, will try it tonight. Should be fine from here. 🙂

Rens