[Gelöst] The count is not showing through wpv-items-count shortcode
This support ticket is created vor 3 Jahre, 7 Monate. 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I'm trying to use [wpv-items-count] to get the filtered count of posts in a CPT based upon custom field vehicle-location but nothing seems to work. I think the problem might be that this custom field is related to another CPT? How can I make this work?
I see some major differences between settings of the view "Garage Count EP2" that is showing the count for "EP2" and the view "Garage Count EP1" that should be showing the count for the "EP1".
Garage Count EP2: hidden link
Garage Count EP1: hidden link
Is this difference in post type selection and the query filter section on purpose?
I understand that the "Vehicle Location" field consists of options programmatically generated from the posts in the "TMNA Locations" post type.
In this case, this field will contain the post ID of the selected "TMNA Locations" post.
Considering the example of view "Garage Count EP1", if you need the list of posts where the "Vehicle Location" field has the selected option "Plano Parking Lot EP1 Level 1" TMNA Locations post ( /wp-admin/post.php?post=4986&action=edit ), you'll pass its ID: "4986" in the query filter section.
( screenshot: hidden link )
You can repeat the same for other views, by just changing the ID of the target TMNA Locations post.
Tip: You don't need separate views for showing the counts of different garages.
You can keep just one view for this purpose and set the query filter to get the target TMNA Locations post's ID, through view's shortcode attribute, for example, 'post'.
( screenshot: hidden link )
I've removed the reference to your website's domain from the messages in this thread. Please let me know if you'd like any other information to be removed/retracted.
If you'd like to get the count from the multiple post IDs, you'll need a custom shortcode, for example:
On the front-end, you can use this new custom shortcode like this, with the target IDs passed in the shortcode attribute:
[get_sum_views_garage_count id="4986,4987,4988"]
Note: The custom code examples from our forum are shared to get you started in the right direction. You're welcome to adjust them as needed and for more personalized customization assistance, you can consider hiring a professional from our list of recommended contractors: https://toolset.com/contractors/
For a case where you need the count from more than one garage location:
[get_sum_views_garage_count id="4986,4987,4988"]
Note: The admin access no longer seems to work. In case you're still facing some difficulty in using this, please share the admin access details again and also the link to a page where you have tested this.
I've created a test page to explain what I mean by using a single view to show count from any garage location and even for showing the sum from multiple locations:
Page: Test page from waqar:
yourwebsite.com/test-page-from-waqar/
Please note how this page is using only 1 View, "View to get the garage count" for all the different garage locations.
You can remove all the code below the line "// Put the code of your snippet below this comment.", in the file named "temp.php" from the folder "wp-content/toolset-customizations/" and it will be fixed.
As for the custom shortcode in the theme's "functions.php" file, you can update this new view's slug in it:
yes, I understood this part of it. But how do I add all of those 'ep1 level* together into one total? so level1 + level2 + level3 + level 4 + level 5? Or is that not possible?