Skip Navigation

[Resolved] Shortcode for displaying search result count shows nothing

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

Problem:
How to get the [wpv-items-count] and [wpv-found-count] shortcodes to output results.
Solution:
The shortcodes work in the Loop. If used outside the Loop, e.g. on a static page where a View is added, they will not display anything, they need to be added to the view itself.
Relevant Documentation:
https://toolset.com/documentation/views-shortcodes/#wpv-items-count
https://toolset.com/documentation/views-shortcodes/#wpv-found-count

This support ticket is created 7 years, 10 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 2 replies, has 2 voices.

Last updated by Nigel 7 years, 10 months ago.

Assisted by: Nigel.

Author
Posts
#402061

I am trying to get the [wpv-items-count] and [wpv-found-count] shortcodes to display a number on a search results page. I don't see the shortcode as text, I see nothing.

I've searched all over the forum and can see no one else with this issue so I imagine it's something simple.

I would very much appreciate your help. Thanks.

#402183

Sorry, I had added the shortcodes to the page which displays the search results and not the Loop Output itself.

All working now.

#402199

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Nic

You pipped me to the post. For the benefit of any other clients reading this post, here was my reply:

Here is the documentation for the shortcodes:
https://toolset.com/documentation/views-shortcodes/#wpv-items-count

The shortcodes are for displaying in a View (which is a database query that returns some number of posts, custom posts, taxonomies, whatever).

If you add

Showing [wpv-items-count] posts of [wpv-found-count] posts found.

to a static page, for example, the shortcodes won't output anything.

You would normally add them to the loop section of your View, but outside the loop output itself (otherwise they will repeat for every item in your loop).

Something like this:

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
		<wpv-loop>
          <h3>[wpv-post-link]</h3>
		</wpv-loop>
	<!-- wpv-loop-end -->
	<p>Showing [wpv-items-count] posts of [wpv-found-count] posts found.</p>
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.