enqueue jQuery
-
I have the following code in a mu-plugin file that adds a couple of buttons with popup windows next to the add media button, it works great but after doing some reading I think I am supposed to enqueue the jQuery which I have tried to do but I’m not sure how to do it for the following:
add_action('media_buttons_context', 'add_my_custom_button'); function add_my_custom_button() { ?> <script> jQuery(document).ready(function($) { $('.popup').click(function() { var NWin = window.open($(this).prop('href'), '', 'scrollbars=1,height=400,width=400'); if (window.focus) { NWin.focus(); } return false; }); }); </script> <a href="https://example.com" class="popup button">test button 1</a> <a href="https://example.com" class="popup button">test button 2</a> <?php }
Could anyone help me out, thanks.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘enqueue jQuery’ is closed to new replies.