Skip Navigation

[Gelöst] Custom shortcode in a conditional statement

This support ticket is created vor 4 Jahren, 9 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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)

Dieses Thema enthält 3 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von cassianS vor 4 Jahren, 9 Monaten.

Assistiert von: Christian Cox.

Author
Artikel
#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: versteckter Link
- Link to the view where I experience issues: versteckter 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!