Home › Toolset Professional Support › [Resolved] condition message if post is pending status
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 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
This topic contains 4 replies, has 2 voices.
Last updated by Shane 2 years, 11 months ago.
Assisted by: Shane.
Dear Sir/Madam,
I have a classic View, I select posts with status of publish or pending. I want to show condition message if post is pending status, how can I define the condition?
Best regards,
Kelvin.
Hi Kelvin,
You will need to use the following shortcode to get the post status.
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153411
However to write this in a conditional shortcode it would be.
[wpv-conditional if="('[wpv-post-status]' eq 'pending')"] Some text to display below. [/wpv-conditional]
Please let me know if this helps.
Thanks,
Shane
Dear Shane,
I finally fix the condition
[wpv-conditional if="( $(wpcf-member-number) eq '' ) OR ('[wpv-post-status]' ne 'publish' )"]....[/wpv-conditional]
May I know what kind of function must be registered from Toolset > Setting > Front-end Content > Functions inside conditional evaluations
Thanks
Hi Kelvin,
Happy to see that you're able to format the shortcode correctly now.
May I know what kind of function must be registered from Toolset > Setting > Front-end Content > Functions inside conditional evaluations
Usually you will register any custom function that you want to make use of in your conditional statement.
Let's say you have a function get_day() and this date returns the current. In this case monday. However in your conditional you only want to display a message on Tuesdays.
So you will add your custom function get_date() to this setting and you can use it in our conditional shortcode like this.
[wpv-conditional if="( 'get_date()' eq 'Tuesday' )"]....[/wpv-conditional]
Please let me know if this clears it up for you.
Thanks,
Shane