Skip Navigation

[Resolved] wpv-control-post-relationship and wpv-control-post-ancestor

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.

This topic contains 2 replies, has 2 voices.

Last updated by katjaS-3 4 months ago.

Assigned support staff: Waqar.

Author
Posts
#2263035

Hi Shane,

I have created view and set with a filter with a specific post reationship and selected the option "Post-ID and URL-Parameter".
The use case (again as u might remember) is a book review blog. I have 2 customized post types: Books and Book authors.
I want to create a view for all books and have a filter to select a book from a specific book author
I have created view and set with a filter with a specific post reationship and selected the option "Post-ID and URL-Parameter".
I guess I need to use: wpv-control-post-relationship and wpv-control-post-ancestor but unfortunately I am missing the syntax. could you please guide me?

#2263359

Waqar
Supporter

Languages: English (English )

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

query-filter-screenshot.png
step-2.png
step-1.png

Hi,

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

To add a relationship filter, you'll click the "New filter" button from the "Search and Pagination" section and choose the "Post relationship or repeatable field groups owner" option.
( example screenshot: step-1.png )

From the next screen, you can select the type of field, the relationship, the default option label, and sorting by field and direction.
( example screenshot: step-2.png )

When you'll click the "Insert shortcode" button, the generated code for the relationship filter field will look like this:


[wpv-control-post-relationship ancestors="book-author@book-book-author.child" url_param="wpv-relationship-filter"]
<div class="form-group">
	<label for="wpv-relationship-filter">[wpml-string context="wpv-views"]Book Authors[/wpml-string]</label>
	[wpv-control-post-ancestor type="select" default_label="-select-" ancestor_type="book-author@book-book-author.child"]
</div>
[/wpv-control-post-relationship]

Note: In this example, the 'Books' post type is the parent and the 'Book Authors' post type is the child, with the relationship slug 'book-book-author'.

In the "Query Filter" section, the relationship filter will be added automatically too.
( example query-filter-screenshot.png )

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

regards,
Waqar

#2264033

My issue is resolved now. Thank you!