Open benlk opened 4 years ago
The above works pretty well for the most part, except clicking the republish button opens an empty modal
Just kidding. That only happens when there are multiple instances of the widget on the page, presumably because they're both trying to target the same modal?
Might be best to check if the widget is active before attempting to display it? That would prevent multiple cases of it being on the page.
Or, would it be best to allow for multiple instances of it to be on the page? 🤔
If there are multiple instances of the widget on the page, are there multiple instances of the modal markup on the page, or just one? My thought is that we could rejigger the widget/modal so that outputting the widget enqueues the modal in the footer, and repeated outputs of the widget would only re-enqueue the modal. It would only be output once, despite being enqueued multiple times.
... unless there's a need to have different widgets have different modal texts.
Consensus from meeting: multiple widgets, please.
Talked with one client today who wanted just the button from the widget; the code to do that is here:
Ideally, a block/widget/shortcode to output that would be part of this plugin, rather than part of something maintained on a client's own theme or site-specific plugin.
Would PRs made to this plugin be merged and deployed to wp.org?
@benlk I think we can just call it using something like
instead of having to create a new template tag for it.