We create a shortcode that looks for a string in a URL path. It works fine.
[string-exists name="category"]
This shortcode is also registered in Toolset. However, when I added to a condition nothing happens. Is my syntax correct?
[wpv-conditional if="( '[string-exists name="category"]' eq 'category' )"] DO THIS [/wpv-conditional]
Hello,
I don't see anything wrong in your syntax.
How do you setup the custom shortcodes [string-exists]?
Please provide detail steps to duplicate the same problem, I need to test and debug it in my localhost, thanks
Thank you!
The shortcode as follows:
add_shortcode('string-exists', 'string_exists_func');
function string_exists_func($atts, $content){
extract( shortcode_atts( array(
'name' => '',
), $atts ));
$url = '<em><u>hidden link</u></em>' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$res = '';
if (strpos($url,$name) !== false) {
$res = $name;
}
return $res;
}
and to test I loaded the shortcode in as the image shows. I also loaded it into the functions.
Thanks for the details, I have tried the custom codes and the steps you mentioned above in my localhost with a fresh WP installation + the latest version of Toolset plugins, it works fine:
I can see the result "DO THIS" when URL has string "category".
So the problem you mentioned above is abnormal, please check these:
1) Make sure you are using the latest version of Toolset plugins, you can download them here:
https://toolset.com/account/downloads/
2) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2020, deactivate all custom PHP/JS code snippets, and test again
3) Also check if there is any PHP/JS error in your website:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/
4) If the problem still persists, please provide database dump file(ZIP file) of your website, you can put the package files in your own google drive disk, share the link only, also point out the problem page URL, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/
Thank you. This is just odd. No conflicts but just not working on this site. We will investigate it closer.