Hello,
I tried to put this code in a header.php file but it does not work.
<?php
echo do_shortcode( '[wpv-conditional if="(\'[types usermeta=\'votre-sport\' current_user=\'true\' output=\'raw\'][/types]\' eq \'basket\')"]<p>texte</p>[/wpv-conditional]' );
?>
Why ?
Thanks
Hi Christophe,
Thank you for contacting us and I'd be happy to assist.
A better way to include these shortcodes in the header.php file would be through a content template:
1. You can create a new content template from Toolset -> Content Templates and insert your desired shortcodes, in that.
( it doesn't need to be assigned to any page, post type or archive etc )
Example:
[wpv-conditional if="( '[types usermeta='votre-sport' current_user='true' output='raw'][/types]' eq 'basket' )"]
<p>texte</p>
[/wpv-conditional]
2. After that, you can echo this content template's output in the header.php file, using the content template shortcode (wpv-post-body):
( ref: https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-body )
echo do_shortcode('[wpv-post-body view_template="template-slug" suppress_filters="true"]');
Note: You'll replace "template-slug" with the actual slug of your content template.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar