Skip Navigation

[Resolved] condition message if post is pending status

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

Author
Posts
#2308501

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.

#2308547

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

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

#2308949

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

#2308973

Thanks

#2310255

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

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