WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Adding javascript from plugin only on plugin page

[Resolved] Adding javascript from plugin only on plugin page

  • Josh
    Participant

    @josh401

    Hi,

    I have been trying to add a few javascript files to my plugin. One’s that will only fire when on my plugin settings page.

    Here is what I have so far:

    function my_plugin_admin_init() {
        // what your plugin needs in its <head>
    	wp_register_script( 'jwl_sliding_script', plugins_url('js/jwl_admin_sliding.js', __FILE__) );
    }
    add_action( 'admin_init', 'my_plugin_admin_init' );
    
    function my_plugin_admin_styles() {
    	wp_enqueue_script( 'jwl_sliding_script' );
    }
    add_action('admin_print_styles-ultimate-tinymce', 'my_plugin_admin_styles');

    But I think I have something wrong, as the script is not doing what it’s supposed to do.

    Am I on the right track here?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Adding javascript from plugin only on plugin page’ is closed to new replies.