Skip Navigation

[Resolved] Short Code Display

This support ticket is created 2 years, 3 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.

Our next available supporter will start replying to tickets in about 1.15 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#2435525

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.

#2435655

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

#2436441

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.

#2436457

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

#2436459

Secondly please guide me how create Number of Posts Counts for individual post types.

I have Post types Beaches, Property, Waterfalls

#2436655

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

#2436697

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.

#2438089

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.

#2438107

Thank you so much, i will work around this and revert back.

#2438703

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.