Skip Navigation

[Resolved] Querying item count of "child post of post" under given category

This support ticket is created 4 years, 2 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 7 replies, has 2 voices.

Last updated by deanL 4 years, 1 month ago.

Assigned support staff: Minesh.


For example, on this page: hidden link (category = Asia) I have 6 posts, thus you can see "6 scams".

Some of these posts have child posts. Eg "English practice or “offer to help scams” in China" has 3 child posts, "Tourist-oriented traditional chinese medicine (TCM) clinics scams in China" has 1 child post. However, these child posts are not associated directly with the Asia category.

What do I do if I want to show the total of those posts, ie making it show "6 scams. 4 stories."?



Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - I can see that you are loading the taxonomy archive for the taxonomy category. When you say child posts, I would like to know, how the child posts are configured on your setup - is it using post-relationship?


Thank you Minesh for looking into this.

Let me try to explain the site structure:

Regions eg "Asia" [Top level category]
- - Countries eg "China" [Second level category]
- - - - Posts eg "English practice or offer to help scams” [Posts type]
- - - - - - Stories eg "I was a victim of this scam" [Stories type]

Posts vs Stories = One to many relationship



Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Thank you for sharing site structure. I see you mentioned that there is one to many post-relationship created between posts and stroies.

Now, I would like to know, in what structure you want to display the content or you just want to display the count of posts? Can you please give me example?


Hi Beda, at the moment, I have an existing view that outputs Posts items found under given category that looks like this:
[wpv-view name="view-name" wpvcategory="{archive name}"]

See hidden link

I just need to add next to it showing total of Stories item found under Posts under the same category, eg "6 scams. 4 stories."



Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I need access details to check on your install and to figure out the solution you are looking for.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.



Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I checked and found that you are using the child view "scam-posts-count" to display the count belongs to the current category but now you also want to display the "stories" which belongs to the posts.

The thing is that story belongs to post with one-to-may relationship so we can display the count for each scam post and disply how many stories belongs to that.

To display the totat number of count - you need to either write a custom shortcode that fulfills your need.


I was hoping this can be done using Toolset's built-in function. Looks like I have to find someone else to help me with custom shortcode.