• Hi, I’m new to WordPress. Here is the code:

    function add_teo_dd(){
    	wp_register_script( 'teo_dd', plugins_url( '/msdropdown/jquerydd.min.js'), array( 'jquery-core' ), '20140608', true );
    	wp_enqueue_script( 'teo_dd' );
    }
    add_action('wp_enqueue_scripts', 'add_teo_dd');

    My humble jquerydd.min.js depends on jquery and it is located in
    /wp-content/plugins/msdropdown/jquerydd.min.js
    I echoed out plugins_url( ‘/msdropdown/jquerydd.min.js’) to see if the resulting url is properly composed, and yes it is:
    plugins_url=http://www.my_site.com/wp-content/plugins/msdropdown/jquerydd.min.js

    The problem is my js file isn’t included! 🙁
    Help! Thank you!

Viewing 1 replies (of 1 total)
  • Thread Starter teo74wp

    (@teo74wp)

    never mind, I managed to work for me:

    wp_register_script( 'teo_dd', plugins_url( '/msdropdown/jquerydd.min.js'), array( 'jquery-core' ), '20140608', true );
    wp_enqueue_script( 'teo_dd' );

    without using a function and add_action():

    function add_teo_dd(){
    	wp_register_script( 'teo_dd', plugins_url( '/msdropdown/jquerydd.min.js'), array( 'jquery-core' ), '20140608', true );
    	wp_enqueue_script( 'teo_dd' );
    }
    add_action('wp_enqueue_scripts', 'add_teo_dd');

Viewing 1 replies (of 1 total)

The topic ‘problem with wp_register_script, no errors, but no enqueing’ is closed to new replies.