Skip Navigation

[Résolu] The count is not showing through wpv-items-count shortcode

This support ticket is created Il y a 2 années. 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.

Marqué : ,

This topic contains 25 réponses, has 3 voix.

Last updated by larryL Il y a 2 années.

Assigned support staff: Luo Yang.

Auteur
Publications
#1777097

Waqar
Supporter

Languages: Anglais (English )

Timezone: Asia/Karachi (GMT+05:00)

Sure, I've set your next reply as private.

#1777103
#1777107

FOr some reason my reply did not get added privately?

#1779003

Waqar
Supporter

Languages: Anglais (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

I've read the requirements shared in the last message and have checked the involved views and custom shortcode, but, unfortunately, I couldn't fully understand what you're trying to accomplish.

Also, I couldn't connect how this is related to the count of the garage's scenario that we've been discussing in this thread and which is now working.

If you'll check the view "View to get the garage count", we're telling the view to bring all posts where the "Vehicle Location" field's value is equal to what is available in the shortcode attribute "post".
( screenshot: hidden link )

But, if you'll check the "Query Filter" section of the view "view to get the absense points", it is linking "post" shortcode attribute to multiple custom fields, which will never work.
( screenshot: hidden link )

Can you please share some details about what was expected from this new view "view to get the absense points" and I'll be in a better position to suggest the next steps.

Note: I've set your next reply as private again.

regards,
Waqar

#1779675

I didn't mean to be confusing and I thought that maybe you nailed the issue with the filter but that didn't solve it. I changed the shortcode to 'view'.

Anyway, I am trying to do a similar calculation except across field values not locations. So I figured I would use the count in the output of each view for each different field and total them up for each user-id in the absense view. For example:

If 'devtools' user had a value of 1 in the 'left post early' field and a value of 1 in the 'no call no show' field the total should be '2'. However, if 'devtools' user had a value of 1 in the 'left post early' field on one day, a value of '1' in the 'left post early' on another day, and a value of 1 in the 'no call no show' field the total should be '3'.

#1783933

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hello,

Waqar is on vacation, I will take care of this thread, but I am missing in this thread.

I assume we are talking about your website:

Please elaborate the questions with more details:

If 'devtools' user had a value of 1 in the 'left post early' field and a value of 1 in the 'no call no show' field the total should be '2'. However, if 'devtools' user had a value of 1 in the 'left post early' field on one day, a value of '1' in the 'left post early' on another day, and a value of 1 in the 'no call no show' field the total should be '3'.

Where and how can I see the 'left post early' field and 'no call no show' field?
Where and how do you want to set a value of 1 in the 'no call no show' field the total should be '3'?
Where and how can I edit your custom PHP codes?

Please provide detail steps for above questions? thanks

#1784955

Please make my reply private

#1785035

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

OK, I have enabled the private message box, please provide more details:
https://toolset.com/forums/topic/the-count-is-not-showing-through-wpv-items-count-shortcode/page/2/#post-1783933

#1785107
#1785235

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

OK, I can find the "left post early" field and 'no call no show' field, where and how do you display the total value in front-end? or where and how do you want to store this value in backend of a custom field?
Please provide the URLs and take a screenshot for it.

I have checked the URL you mentioned above:
Search with keyword "total", but found noting.

#1788395

Please make the reply private.

#1788457

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Private message box enabled again

#1788473

If you don't mind please remove the url references from the public replies above. Thanks.

OK, Each absense related post under the 'time' CPT tracks these things. For example, hidden link

If you look in the post the 'user' received the leave type 'Tardy (61 Min+...) which has the associated field value (tardy 61) of '1.5'. If I was simply displaying the value they currently have, this would be easy. I would just place all the fields in the view and one of them would have a value for the post in the loop. But that isn't what I'm trying to do.

I/m trying to generate a running total of points that are received to date. So if someone received 1.5 today but they received .5 (for a different reason) last month I want to be able to add them up automatically (say, between a 6 month period).

So that is why a figured if I generated those views first and then added the views together that would be the way to go. But perhaps I was wrong.

#1788637

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Thanks for the details, there isn't such kind of built-in feature within Toolset Views, Views can only display data and can not calculate the values.

In your case, it needs custom codes, but according to our support policy, we don't provide custom codes support:
https://toolset.com/toolset-support-policy/

For example, you can create a custom shortcode with a custom PHP function:
https://codex.wordpress.org/Shortcode_API

In this function, get the 'time' post custom field value:
https://developer.wordpress.org/reference/functions/get_post_meta/

Check those value with your custom conditions: if someone received 1.5 today but they received .5 (for a different reason) last month

And display the value you want.

I have removed all links in my answers above.

#1795033

My issue is not resolved.