Hi,
I want to display counts of posts and some other taxonomies, i am using Short Code from Admin bar and Toolset - Fields and Views-> under taxonomy i have selected "Cities" and Display option -> Term post count and generated short code [wpv-post-taxonomy type="city" format="count"] but when i place this on any page, elementor or classic editor, no data is showing, tried creating shortcode with different parameters also, please help.
Hi,
Thank you for contacting us and I'd be happy to assist.
The shortcode "wpv-post-taxonomy" should work when used inside any single post/page's content or loop of the view, where this "city" taxonomy is attached.
For any other case, you'll have to also include the "item" attribute with the target page/post ID, from which you'd like to get the 'city' taxonomy terms.
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-taxonomy )
If including the "item" attribute also doesn't work, you're welcome to share temporary admin login details, along with the example page where this shortcode is not working.
Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.
regards,
Waqar
Thank you for sharing the admin access details.
As you haven't shared any exact place where the shortcode wasn't working, I tested it inside the template for the single property posts ( "Content template for Property 2" ).
At the bottom, you'll see the shortcode added in a "Fields and Text" block.
( screenshot: hidden link )
And, you'll see that it is showing the count of the posts attached to the current post's "city" term correctly.
Screenshot from the property post "Bhakti Kutir Hotel, Karwar":
hidden link
This property post is attached to the "Karwar" city taxonomy term and if you'll search it in the list of city taxonomy terms in the admin area, you'll see that the count of posts attached to it, matches the one showing on the front-end.
( screenshot: hidden link )
This suggests that the "wpv-post-taxonomy" shortcode is working as expected. If you tried to use it at some other place and it didn't work there, please share the exact steps, and I'll check it out as well.
Hi Waqar,
Thank you so much for detailed explanation.
What i understood is, Short Code Word only in Content Template Pages, correct?
I was looking for Short Execution in Home page, which is not a content Template Page, its a elementor page.
My goal is, i was creating Home page using elementor builder, in which i wanted to display Counts of Cities, Number of Hotels etc.
Is there any way to achieve this?
-
Praveen
Secondly please guide me how create Number of Posts Counts for individual post types.
I have Post types Beaches, Property, Waterfalls
Thanks for writing back.
1. To show the count of the posts attached to each taxonomy term, you can create a taxonomy view using the classic/legacy editor.
For example, for cities, you'll create a taxonomy view that will cycle through all the taxonomy terms from the "Cities" taxonomy. In the loop of this view, you'll show the term name, and the same "wpv-post-taxonomy" shortcode to show the count of its posts. This way your list of all city names with their post count will be ready and you can place that view's shortcode in the Elementor builder too.
Similarly, you can create more taxonomy views for the other custom taxonomies too.
2. For creating the list of posts count, in each custom post type, you can create a classic/legacy editor post view for each post type. The view's output would only consist of the shortcode "wpv-found-count", which will return the count of posts/items returned by the view:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-found-count
Hi,
Thank you for your reply.
I am finding bit difficult to understand.
Can you please create Total Post Count Short Code for "Beaches" post type?
I will customize for other queries.
I've created an example view named "View to show count of Beaches posts":
{yourwebsite.com}/wp-admin/admin.php?page=views-editor&view_id=3513
Please note how I've selected the "Beaches" post type in the content selection settings.
( screenshot: hidden link )
In the view's "Loop Editor" section, I've only included the line "Total Beaches:[wpv-found-count]" and the view's actual loop is empty, as we don't need to show anything from each result/post.
( screenshot: hidden link )
And in the pages, I've added a draft page named "Test page from TS support" with a "Fields and Text" block that has this shortcode for the newly created view:
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-view )
[wpv-view name="view-to-show-count-of-beaches-posts" cached="off"]
Similarly, you can create more views for the other post types, and you'll only need to change the target post type, in the view's "Content Selection" section.
Thank you so much, i will work around this and revert back.
You're very welcome and let me know if you have any follow-up questions.
And, for any new questions or concerns, please start a new ticket.