Skip Navigation

[Resolved] Displaying number of posts that are published, drafted, or pending by author

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

Problem:

The issue here is essentially the user wanted to display the number of items that their view has found.

Solution:

This can be done by adding the [wpv-found-count] shortcode to your view.

This support ticket is created 5 years, 8 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by FelipeP5703 5 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#1239190
number_of_posts.jpg

Tell us what you are trying to do?
I want to show the user on his "My Account" how many posts they have published, drafted, and pending review. I'm using View that has two queries:
1) Posts with author the same as the current logged in user
2) Posts with status of any.

I also have a shortcode on the Output Editor to show how many posts in total, [wpv-found-count]... but I can't seem to find in the documentation, any shortcode that shows the number of published, drafted or pending review posts.

Is there any documentation that you are following?
I looked here for directions but didn't find anything that shows drafted or pending posts: https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-found-count

Is there a similar example that we can see?
Not that I know of

#1239206

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2019-05-03 at 10.56.41 AM.png

Hi Felipe,

Thank you for contacting our support forum.

This is actually possible to do because our views plugin has a post status filter that you can use to display all the posts of a particular status. See Screenshot

You can just select the posts that you want to display.

Then you can use the shortcode here to display the post status itself
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-153411

Please let me know if this helps.

Thanks,
Shane

#1239240
number_of_posts4.jpg
number_of_posts3.jpg
number_of_posts2.jpg

Shane, I don't think you understood my request. What you suggested I already have done, as you can see the status below the picture.

What I want to show is the number of published posts, number of drafted posts, and the number of pending posts from that Author.

As you can see on this screenshot, I already have that query filter with the options I want. But the issue is counting how many posts are published, drafted, and pending.

The shortcode [wpv-found-count] only shows how many posts there are in total. Is there a way to filter this shortcode to show how many are published, how many are drafted and how many are pending?

#1239255

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Felipe,

Thank you for the clarity.

In this case you will need to create 3 of the same views just with the filter different for the status of the post you want to count.

Then you can just use the [wpv-found-count] in each of the respective views. So the view for published post based on the current user will only show the count for the published posts etc.

Please let me know if this is clear for you.

Thanks,
Shane

#1239264

I was afraid you were going to say that. I already had thought of it but maybe there was an easier way to do it.. My issue is resolved now. Thank you!