Hi,
I’ve added a custom extension to a client’s theme, and I need to toggle its visibility using a button—essentially switching between the extension and the photo gallery.
Currently, I’m doing this by targeting the DOM element using the id
assigned when the extension is registered as a plugin. However, this approach is unreliable—if the plugin name changes, the id
changes as well, and the DOM lookup fails, breaking the functionality.
Is there a recommended way to achieve this functionality without relying on hardcoded id
s for the extension blocks added to the theme? Ideally, I’d like a more stable or dynamic method of targeting the extension’s DOM node.
Thanks in advance!