WordPress.org

Ready to get started?Download WordPress

Forums

JQuery Mega Menu Widget
[resolved] WP_enqueue_script was called incorrectly (5 posts)

  1. syndrael
    Member
    Posted 2 years ago #

    Hello,
    I'm under WP3.3.2 and i've tried to install jqMegaMenu 1.3.8
    With the options below in my wp-config.php file i get this error.
    define('WP_DEBUG', true);
    // Enable Debug logging to the /wp-content/debug.log file
    define('WP_DEBUG_LOG', true);
    // Disable display of errors and warnings
    define('WP_DEBUG_DISPLAY', true);

    Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in E:\www\wp_pure\wordpress\wp-includes\functions.php on line 3587

    In my mind it's due to the constructor in the plugin after the first wp_enqueue_script:
    // Header styles
    add_action( 'wp_head', array('dc_jqmegamenu', 'header') );
    // Scripts
    wp_enqueue_script( 'jquery' );
    wp_enqueue_script( 'jqueryhoverintent', dc_jqmegamenu::get_plugin_directory() . '/js/jquery.hoverIntent.minified.js', array('jquery') );
    wp_enqueue_script( 'dcjqmegamenu', dc_jqmegamenu::get_plugin_directory() . '/js/jquery.dcmegamenu.1.3.4.min.js', array('jquery') );

    Could you correct it ?
    Is it possible to register jquery for the footer ?
    Best regards from PAris,France
    S.

    http://wordpress.org/extend/plugins/jquery-mega-menu/

  2. remix4
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for the info and will look at updating in the next update.

    In the meantime though this is only a "Notice" and will not affect how the plugin operates

  3. syndrael
    Member
    Posted 2 years ago #

    In the meantime though this is only a "Notice" and will not affect how the plugin operates

    That's correct but i like clean code.. LOL.
    In the same time, could you modify the code in order to make possible to put jquery in footer.
    Before your plugin, my Jquery was queued in the footer but because your dynamic jquery javascript, jQuery must be queued in the header.
    Best regards
    S.

  4. benmoreassynt
    Member
    Posted 2 years ago #

    I've posted a patch here

  5. syndrael
    Member
    Posted 2 years ago #

    Thank you, but it's too late. I've changed this plugin.
    I hope it will be helpful for somebody else..
    Best regards
    S.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic