Skip Navigation

[Resolved] display related posts

This support ticket is created 3 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by mauro 3 years, 10 months ago.

Assisted by: Waqar.

Author
Posts
#1679669

Hi, this question is related to the following ticket: https://toolset.com/forums/topic/display-related-post-type-2/

I managed to list all the Artworks of an Artist in the Artist single page template. However, I am unable to display all the related Artworks of an Artist in the Artwork single page template. How should I go about doing this? I am using Blocks not Classic.

#1680191

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

view-filter-example.png

Hi,

Thank you for contacting us and I'd be happy to assist.

To achieve this, you can follow these steps:

1. Please create a new content template and name it something like "CT for showing related Artworks".
( WP Admin -> Toolset -> Content Templates )

Note: You don't have to assign this content template to any post or page.

2. In this new content template, you can add a "View" block and set it to show the "Artworks" posts.

3. At this point, this newly created view will be showing all the "Artworks" posts. To limit it to only to the posts related to the current "Artist", you'll need a post-relationship "Query Filter" with "The current post in the loop" option, as shown in the attached screenshot.

4. The last step would be to include the shortcode for this newly created content template inside the Artwork single page template, through a "Fields and Text" block.


[wpv-post-body view_template="CT for showing related Artworks" item="@artist-artwork.parent"]

Note: You'll replace "CT for showing related Artworks" with the actual name of the content template created in step 1. Also "artist-artwork" will need to be changed to match the actual relationship slug used on your website.

The item="@artist-artwork.parent" part in the shortcode changes the scope of the content template from the current "Artwork" post to its related "Artist" post.
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/ )

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1680587

Hi Waqar, thanks so much for your help, I truly appreciate it. I can now create the related posts. The solution you provide me works like a charm!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.