Skip Navigation

[Resolved] Custom shortcode in a conditional statement

This support ticket is created 4 years, 1 month 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by cassianS 4 years, 1 month ago.

Assisted by: Christian Cox.

Author
Posts
#1535975

Tell us what you are trying to do?
- I am trying to apply my custom shortcode [extract_domain_from_url] which extracts domain from the URL and compares this URL with a requested using toolset conditional statement but it doesn't work. At the same time, the shortcode itself is working properly. The shortcode is also registered in the Toolset.
The shortcode is created in the functions.php file of the child theme

Is there any documentation that you are following?
- yes, this one: https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/using-shortcodes-in-conditions/

Is there a similar example that we can see?
- I don't know

What is the link to your site?
- The link to the page with a related view: hidden link
- Link to the view where I experience issues: hidden link

#1536027

Hello, would you like to provide login credentials so I can see this in wp-admin? If not, can you copy + paste the complete conditional here for me to review?

#1536251

I think it was an issue nesting quotation marks. The following conditionals seem to work as expected:

[wpv-conditional if="( $(wpcf-uwc-video-link) ne '' )"]
      		[wpv-conditional if="( '[extract_domain_from_url url="[types field='uwc-video-link' output='raw'][/types]"]' eq 'youtube.com' )"]
      			[vc_video link="[types field='uwc-video-link' output='raw'][/types];rel=0&controls=0" el_class="UWCvideo1"]
      		[/wpv-conditional]
      
            [wpv-conditional if="( '[extract_domain_from_url url="[types field='uwc-video-link' output='raw'][/types]"]' ne 'youtube.com' )"]
      			<p>Not YouTube ;-)</p>
            [/wpv-conditional]
          
      [/wpv-conditional]

Can you confirm?

#1536321

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.