Saltar navegación

[Resuelto] Trying to find result of shortcode

This support ticket is created hace 4 años, 3 meses. 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.

Este tema contiene 1 respuesta, tiene 1 mensaje.

Última actualización por AlimB3245 hace 4 años, 3 meses.

Autor
Mensajes
#1808509
Screen Shot 2020-10-12 at 5.57.54 PM.png

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

#1808541

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