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.
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?
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
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
My issue is resolved now. Thank you!