I´m writing a plugin that should show a modal popup with a form on a button click. Now the question is how/where to inject that modal and form HTML?
I can think of these options:
Create it with JS. I could add the HTML with wp_add_inline_script() or wp_localize_script in a JS var and append it to the DOM.
Create it with JS, but load the form HTML with AJAX from a html or php file.
CON: loading would take a little time
- echo out a div with display:none.
Question: Where in the document would I output it? I can´t rely on the theme to support wp_footer() and it doesn´t feel right to simply hook it into the_content(). What would be a good hook?