Skip Navigation

[Resolved] How to display posts count

This support ticket is created 5 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
- 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)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by deanL 5 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#1155479

On the homepage of the website, I want to display total number of published posts. I created a view and inserted the following codes in "Loop Editor":

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
<div>[wpv-post-count]</div>
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

Next I inserted the view shortcode in homepage, the result showed looks like this (total of 11 posts):
11
11
11
11
11
11
11
11
11
11
11

What have I missed?

#1155483

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - you can use the shortcode [wpv-found-count] to display total number of records found by view.

For example:

[wpv-layout-start]
[wpv-items-found]
<div>[wpv-found-count]</div>
<!-- wpv-loop-start -->
<wpv-loop>
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

More info:
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-found-count

#1155754

Ah....! So I just had to move the shortcode outside of the <wpv-loop>!

Not very important, but what is the difference between [wpv-post-count] vs [wpv-found-count]?

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.