Skip Navigation

[Resolved] Post Count View Repeating Times the Database Value

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

Problem:
* I am trying to: Figure out why [wpv-post-count] in and is throwing repeating views in page.
* If the count is 20 using [wpv-post-count] in the loop it prints 20 times in the page view.

Solution:
* This is understandable because you're putting in the loop.
* Putting [wpv-post-count] outside the loop should resolve the issue.

This support ticket is created 8 years 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
- 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 -
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by janO-3 8 years ago.

Assisted by: Dat Hoang.

Author
Posts
#378239

I am trying to: Figure out why [wpv-post-count] is throwing repeating views in page.

I visited this URL: https://toolset.com/forums/topic/taxonomy-post-count/ and https://toolset.com/documentation/views-shortcodes/#wpv-post-count

I expected to see: A single count in the view

Instead, I got: Multiples. If the count is 20 using [wpv-post-count] in the loop it prints 20 times in the page view.

My filter is by User ID and here is my View:

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
		<wpv-loop>
<div class="ui-widget">
  <h1 class="ui-value">[wpv-post-count]</h1>
  <span class="ui-label">Tracks</span>
</div> 
		</wpv-loop>
	<!-- wpv-loop-end -->
	[/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]
#378254

Please note that you're putting [wpv-post-count] in the loop <wpv-loop> and </wpv-loop>, then I think that's reasonable.

I think you might use the wrong code for your purpose.

Can you please take some screenshots and explain more about what your need is?

#378372

I just moved it outside of the loop. Thanks.

[wpv-layout-start]
    [wpv-items-found]
   <div class="ui-widget">
  <h1 class="ui-value">[wpv-post-count]</h1>
  <span class="ui-label">Tracks</span>
</div> 
 <!-- wpv-loop-start -->
        <wpv-loop>
        </wpv-loop>
    <!-- wpv-loop-end -->
    [/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.