Tell us what you are trying to do?
It's the first time I've created a shortcode.. actuallY I just tweaked an existing one created by Toolset supporter Waqar to suit my use.. here it is
add_shortcode('eyewear-collection-exists','check_eyewear_collection');
function check_eyewear_collection() {
$content = do_shortcode("[wpv-view name='related-optician-eyewear-collection-eyewear-collection-ids']");
if(!empty(trim($content))) {
return '1';
}
else
{
return '0';
}
}
I've registered the shortcode as required in the "Third-party shortcode arguments" section, at WP Admin -> Toolset -> Settings -> Front-end Content.
I created a conditional block and I got this option to first select the criteria so I selected Custom Shortcode and the short code was listed .. so all good..
then it asked for some short-code attribute.. not sure what I needed to put here so I left it blank.. then I used '=' and on the right hand side selected 'Static Value' and put '1'
I expected this to work but I am not able to see the result when there is an Eyewear Collection that exists.. I ran the view using custom html
[wpv-view name='related-optician-eyewear-collection-eyewear-collection-ids']
and I am able to view the collection id.. here..
enlace oculto
Just below the stars you will see the 2 ids.. one of them is the eyewear collection id.. so if it exists why is my conditional output showing as blank?
I've created a condition output where it's like this..
https://toolset.com/wp-content/uploads/tmp/Screen_Shot_2020_10_12_at_5.57.54_PM.png
but it doesn't seem to work.. what am I doing wrong?
Is there any documentation that you are following?
Is there a similar example that we can see?
What is the link to your site? enlace oculto
My issue is resolved now. Thank you!
It was my mistake... I didn't realise I needed to activate the Code in settings..;-)..
Regards,
Alim