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?
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
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]?