Skip Navigation

[Resolved] Filtering view by parent posts

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

Last updated by StanleyT8485 4 years, 3 months ago.

Assisted by: Waqar.

Author
Posts
#1767757

I want to filter by parent post but show its child posts in Views.

Parent = COMPANIES
Child = FINANCIALS
I want to show only COMPANIES with a certain custom field AND also FINANCIALS with a specific category.

#1772927

Hey Waqar,

I have another question on this similar issue.

The Views is now showing COMPANIES (Parent) with FINANCIALS (Child) from the FY20 (Category).

Some COMPANIES might not have their FY20 FINANCIALS released yet so the result will be empty. Screenshot: hidden link (Empty result shown in purple).

If the result is empty, how can I show financials from FY19 category instead?

#1773373

Hi Stanley,

To suggest the best way forward, I'll need to see how this view is currently set up.

Can you please share temporary admin login details, along with the link to a page with this view?
( in case of a locally hosted website, you can share a clone: https://toolset.com/faq/provide-supporters-copy-site/ )

I've set your next reply as private.

regards,
Waqar

#1775803

Hi Stanley,

Thank you for sharing the access details.

To show the results from the "FY19" category, when the "FY20" one is not present, you'll need these changes:

1. In the "REIT Child - Retail" view, the "Query Filter" for the category needs to be updated so that it can be controlled through a shortcode attribute.
( screenshot: hidden link )

2. In the parent view "REIT Parent - Retail", the shortcode of the child view needs to be updated to include the required category's slug passed as the shortcode attribute value:


[wpv-view name="reit-child-retail" wpvcategory="fy20"]

As a result, by default, the child view will bring in results attached to the "fy20" category term.

3. The last step would be to include this child view's shortcode, within its "wpv-no-items-found" tags in the "Loop Editor", but with the slug "fy19":


[wpv-no-items-found]
[wpv-view name="reit-child-retail" wpvcategory="fy19"]
[/wpv-no-items-found]

For results where no posts exist for "fy20" term, the second shortcode will bring in post with "fy19" term.

regards,
Waqar

#1778197

My issue is resolved now. Thank you!