Skip Navigation

[Resolved] Need help in views shortcode

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

Problem:

I am trying to: have number of child posts in my search page. Search page shows number of parent posts. I am using this shortcode to display a view [wpv-view name="number-of-reviews"] with filter:
filter:

Select posts that are children of the Post where this View is shown

This works in single parent post but does not show number of reviews in search page.

Solution:

You can change the filter to:

Select posts that are a children of the current post in the loop.

That will be able to work in both cases:

1) single "lawyer" post

2) Loop of "lawyer" posts in view "Arch-View"

Relevant Documentation:

https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/

This support ticket is created 6 years, 8 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/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by simranjeetS-2 6 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#630007
Screenshot 2018-03-30 13.49.30.png

I am trying to: have number of child posts in my search page. Search page shows number of parent posts. I am using this shortcode to display a view [wpv-view name="number-of-reviews"] . This works in single parent post but does not show number of reviews in search page.

Link to a page where the issue can be seen: hidden link

I expected to see: correct number of child posts

Instead, I got: No items found - even if parent has child posts

#630016

Thanks for the details, in the view "number-of-reviews", you are using below filter:
Select posts that are children of the Post where this View is shown

It only works for the single "lawyer" post, in your case, you can simply change it to:
Select posts that are a children of the current post in the loop.

That will be able to work in both cases:
1) single "lawyer" post
2) Loop of "lawyer" posts in view "Arch-View"

More help:
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/

#630040

Thanks Luo Yang. It works.