Sauter la navigation

[Résolu] I have an issue with toolset conditional outputs and with some custom shortcoede

This support ticket is created Il y a 2 années et 10 mois. 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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Ce sujet contient 4 réponses, a 3 voix.

Dernière mise à jour par garenM Il y a 2 années et 10 mois.

Assisté par: Minesh.

Auteur
Publications
#2388825
Screenshot 2022-06-20 082449.jpg
Screenshot 2022-06-17 112400.jpg
Screenshot 2022-06-17 112454.jpg

I have an issue with toolset conditional outputs(doesnt output anything in astra layouts when i use fields and text block from toolset) and with some custom shortcoede(there are some errors with the attributes of the shortcode. am adding as attributes id and slug and if the shortcode is like that->[getProductImage id="[wpv-post-id]" slug="[wpv-post-slug]"] i will get the result and at the end i will get that-> " slug="[some-slug]"] )

lien caché

#2388987

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I will have to check whats going wrong with your setup and for that I will require admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2388993

Nigel
Supporter

Les langues: Anglais (English ) Espagnol (Español )

Fuseau horaire: Europe/London (GMT+01:00)

Hi there

I followed the link you shared and it's not obvious that there is anything wrong on the page.

Likewise, I'm not sure what we are supposed to be looking at on your screenshot with the beer bottles.

In the screenshot of the markup and shortcodes, the one thing I notice is a problem with your use of single or double quotes.

With the wpv-conditional shortcode, the if attribute details appear within double quotes. You cannot then use double quotes inside the if condition, because that brings the if attribute to a close prematurely.

Try changing the output="url" attribute of the wpv-post-featured-image shortcode to use single quotes, i.e. output='url'

#2389149

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

I've created the following content template and added the shortcode to it:
=> lien caché

[getProductImage id='[wpv-post-id]' slug='[wpv-post-slug]']

I've created another content template that holds the conditionals:
=> lien caché

[wpv-conditional if="( '[wpv-post-featured-image output='url']' ne '' )"][wpv-post-featured-image size="full"][/wpv-conditional]
[wpv-conditional if="( '[wpv-post-featured-image output='url']' eq '' )"]<img src="/wp-content/uploads/2022/06/thumbnail_Composition-Default-Fallback.jpg" class="product-image wow animate__animated animate__fadeIn" data-wow-delay="0.5s" data-margin-top="110" data-sticky-for="1199" style="visibility:hidden;">[/wpv-conditional]

And then I've added those content templates to your custom layout:
=> lien caché

[wpv-post-body view_template="show-product-image-shortcode"]
[wpv-post-body view_template="display-conditionals"]

I can see its working as expected on the frontend:
- lien caché

#2401703

My issue is resolved now. Thank you!