Dynamic element visibility
Hi, I'm new to Brizy and I'm working on a Brizy Pro site for a client.
I've added some ACF fields to our WooCommerce products and am displaying them in a Brizy single product template. I've created an ACF URL field for product manual PDFs and am linking that to a 'download manual' button in the product page template. This is all working fine.
However, in some cases we don't have a manual available yet, and I'd rather not display the download button if there is no manual. Is there the ability to somehow display the button if there is a PDF available (ie, if there is anything entered in the PDF URL field) and not display the button if there isn't?
I've looked around and the only dynamic visibility functionality I can find is in relation to elements in the header and footer appearing on all posts/pages or not.
Or -- is there any way to inject extra CSS classes into elements based on field content? That would work too, as I could target those elements with CSS and hide them.
If none of this is core functionality, is there a third party plugin that would do it?
Many thanks,
Peter.
-
Hi Peter,
unfortunately, you cannot set such conditions on the basis of the content received from this field. But I think I see a possible solution. You can create two almost identical product templates and remove the download button from one of them. After that, for your internal use, you can create two tags: manual / no-manual, and then set the first template for products with the "manual" tag and the template without the download button for the "no-manual" tag. When the manual for a certain product appears, you simply change its tag.
If there are not too many products without a manual then you could simply hide the download button with css for these products.
-1
Please sign in to leave a comment.
Comments
1 comment