I am trying to:
Show the Total Custom Posts Count of the CURRENT LOGGED IN USER in a Layout.
The short-code below works perfect in the Custom Post Loop:
But on the Page layout it has no effect:
Here's my code:
<b>#[wpv-items-found]</b> <a href="<em><u>hidden link</u></em>">PROJECTS</a><br />
Link to a page where the issue can be seen:
hidden link
I expected to see:
A good example would be:
If user "A" Logs in and creates "3" Projects,
"# PROJECTS" would auto change to > 3 PROJECTS
If tomorrow user "A" Logs in and creates 1 more Project.
"3 PROJECTS" would auto change to > 4 PROJECTS
If next week user "A" Logs in and deletes all his Projects.
"4 PROJECTS" would auto change to > 0 PROJECTS
Instead, I got:
Just
# PROJECTS
No dynamic counter
Well, that shortcode works only in a View's Loop, and it outputs nothing itself.
To display an amount of posts created, that is not the ShortCode to use.
For this, you use wpv-found-count.
A View is needed, even if the View then is displayed thru a Layout at the end, but without View, these ShortCode's won't work.
The View should query the desired Post type.
Then, a Query Filter should be added to it:
Select posts with the author the same as the current logged in user.
The Loop of this View should look minimally like this:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
[wpv-found-count]
<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]
After, this View can be inserted anywhere you want, also thru Layouts as a cell.
It will display only the number of posts found that this user authored.
[wpv-items-found] ShortCode will not return any numeric value.
This is a ShortCode to determine an area in the loop, not to output something:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-items-found