WP Brizy Pro - Feature Request: Shortcode Display Conditions | Option if content of Shortcode is empty, set shortcode Wrapper visibility hidden / display none OR display custom text
It really bugs me that if no Shortcode is displayed on the Front-End that there is an empty space.
It would be cool to have the ability
- if shortcode won't display, hide element x
Good for: Having a Shortcode and Information like a text element that depence on the shortcode.
Example: if no tags is shown, hide the text "Tags" above"
- to set the wrapper as hidden / display none if no conent is displayed
- add text instead of the Shortcode (for example for the Germanized [gzd_product_unit_price] Shortcode it displays: "No Price per Unit available")
Thanks!
-
Hello Pascal,
Thank you for your message!
Regarding what you have said, we will try to implement this in the future. When it will be ready, we will tell you! Till then, if you have any other questions or problems, please feel free to ask. We will be happy to help.
Have a nice day and best regards,
Doina
0 -
I was able to write a small script with the help from stackoverflow that hides the shortcode div if it is empty.
I gave the shortcode and the Text Element above it a ID.
It's still missing a checkup / end routine, therefore if there is a shortcode, it spits out an error inside the console.Have a look here https://stackoverflow.com/a/69349956/12347410
(explanation in the SO comments)
or here:function pgpSichtbarkeit() { var pgpShortcode = document.getElementById('Produktgrundpreis-Shortcode').innerText; // if (!pgpShortcode.trim()) if (!pgpShortcode) { document.getElementById('Produktgrundpreis-Text').style.display = "none"; } } pgpSichtbarkeit();0
Please sign in to leave a comment.
Comments
2 comments