Skip Navigation

[Resolved] write custom filter function into wpb-conditional on template

This support ticket is created 5 years, 7 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 – 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)

This topic contains 3 replies, has 2 voices.

Last updated by rexJ-2 5 years, 7 months ago.

Assisted by: Waqar.

Author
Posts
#1215060
Skærmbillede 2019-03-17 kl. 07.57.45.png
Skærmbillede 2019-03-17 kl. 07.58.35.png

Tell us what you are trying to do?
Hi, in my template i have tried a filter that works but it is placed i Query Filter section. I would like to place it the Templates for This View section. How to write that.

 [wpv-conditional if=" ??????"]<p> do something </p> [/wpv-conditional] 

Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-conditional
Is there a similar example that we can see?
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-id
What is the link to your site?hidden link

#1216769

Hi there,

Thank you for contacting us.

We apologize for the delay, as we had an unusually busy queue after the weekend.

From your screenshot ( Skærmbillede 2019-03-17 kl. 07.57.45.png ), I understand that you'd like to target the condition where the date type custom field value falls within today and tomorrow.

If that is correct, you can use the Views plugins date filter in the condition like this:
( ref: https://toolset.com/documentation/user-guides/date-filters/ )


[wpv-conditional if="( $(wpcf-field-slug) gte 'TODAY()' ) AND ( $(wpcf-field-slug) lte 'FUTURE_DAY(1)' )"]
Yes
[/wpv-conditional]

As a result, "Yes" will only be printed when the current post's custom field with slug "field-slug" falls within today and tomorrow.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1216929

Hi Waqar
Thanks for your help. Actually i only want values that falls within that particular day

[wpv-conditional if="( $(wpcf-End-hour) lt 'now()' ) AND ( $(wpcf-START-hour) lt 'now()' )"]

So do you think my code works or yours? Thanks for link to syntax.
Regards
Henrik Paragate

#1216947

My issue is resolved now. Thank you!