Skip Navigation

[Resolved] Show number of child posts in a parent

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

Problem:

show count of child posts in parent post. I have done this partially, but at one place I am incorrect. See pic. For top, I used shortcode [wpv-view name="number-of-reviews"] . This seems to be incorrect. For bottom, I used shortcode [wpv-found-count] in view for child posts. That is why second is correct. How to show number of child posts of parent in parent entry?

<wpv-loop>[wpv-found-count]</wpv-loop>

Solution:

Since you have put the shortcode [wpv-found-count] insider Views loop section, and Views have found two items, so it displays two same numbers "2".

You just need to move the shortcode [wpv-found-count] outside the Views loop, for example:

<strong>[wpv-found-count]</strong>
<wpv-loop></wpv-loop>

Relevant Documentation:

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)

This topic contains 7 replies, has 2 voices.

Last updated by Luo Yang 6 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#629820
Screenshot 2018-03-30 00.42.53.png

I am trying to: show count of child posts in parent post. I have done this partially, but at one place I am incorrect. See pic. For top, I used shortcode [wpv-view name="number-of-reviews"] . This seems to be incorrect. For bottom, I used shortcode [wpv-found-count] in view for child posts. That is why second is correct. How to show number of child posts of parent in parent entry?

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

I expected to see: number of child posts

Instead, I got: something else.

#629899

Hello,

Thanks for the details, since you have put the shortcode [wpv-found-count] insider Views loop section, and Views have found two items, so it display two same numbers "2".

You just need to move the shortcode [wpv-found-count] outside the Views loop section, for example:

hidden link
in section "Loop Output Editor", change the code from:

	<wpv-loop>[wpv-post-body view_template="Loop item in Number of reviews"]</wpv-loop>

To:

	<strong>[wpv-found-count]</strong>
	<wpv-loop></wpv-loop>

And test again

#629946

Thanks for this but there is another problem on same page. Please see pic. The number of reviews are in new line. Why?. How to have raw output in this shortcode?

#629949

Views will output the result in a HTML div tag, so it conducts the issue.
I assume you are going to display the view in same line as text "Client Reviews:", it can be achieved with simple CSS codes, for example, you can edit the view "Number of reviews":
hidden link
in section "Loop Output Editor", click "CSS Editor", add below CSS codes:

div[id^='wpv-view-layout-781']{
display: inline;
}

And test again

#629969
Screenshot 2018-03-30 13.49.30.png

If I use the same shortcode in search page, why it shows no items found? Is it not supposed to show reviews at all places? It is a view, right? The same shortcode shows number of reviews in single post. See pic.

#629998

I assume the original question of this thread has been resolved:
https://toolset.com/forums/topic/layout-does-not-work-with-my-theme-smartmag/#post-629840

For the new question:
why it shows no items found? Is it not supposed to show reviews at all places? It is a view, right?

I checked the URL you mentioned above:
hidden link
There isn't the problem you mentioned in screenshot
hidden link

Please create new thread for the new question, describe detail steps to duplicate the same problem, that will help other users to find the answers. thanks

#630000

Thanks Luo Yang. I will do as you say and create new thread. Please close this ticket as my original query has been resolved. Please change the link in your last post.

#630431

You are welcome.