I think problem with your WordPress. Because I check it again and its working very well. You can try this any other WordPress site.
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 login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in C:\xampp\htdocs\mooresvilleglass.local\wp-includes\functions.php on line 3547
Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in C:\xampp\htdocs\mooresvilleglass.local\wp-includes\functions.php on line 3547
I have the same issue. It’s just a PHP Notice, and by no means a content killing error on the frontend of the Dashboard backend. Deactivating this plugin makes the notice go away (this is all with WordPress Debug on, of course). Looking over the plugin code I can’t seem to pinpoint what would cause this…
And by the way, I am using WordPress 4.1.1 and the latest plugin to date of this post.
Hi Jahidul,
Good day
The error is cause by the enqueue script and style it should be wrap inside function and triggered by add_action. You will see the error when you enable the WP_DEBUG to TRUE.
See below code OLD
wp_enqueue_script('x-jquery-easing', X_PLUGIN_URL.'js/jquery.easing.min.js', array('jquery'));
wp_enqueue_script('x-jquery-main-scroll-up', X_PLUGIN_URL.'js/jquery.scrollUp.min.js', array('jquery'));
wp_enqueue_script('x-jquery-active', X_PLUGIN_URL.'js/active.js', array('jquery'));
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'my-script-handle', plugins_url('js/my-script.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
wp_enqueue_style('x-scroll-plugin-css', X_PLUGIN_URL.'css/custom.css');
wp_enqueue_style('x-scroll-plugin-fontello-css', X_PLUGIN_URL.'css/fontello.css');
Change to NEW
function add_x_scroll_style() {
if ($GLOBALS['pagenow'] != 'wp-login.php' && !is_admin()) {
wp_enqueue_style('x-scroll-plugin-css', X_PLUGIN_URL.'css/custom.css');
wp_enqueue_style('x-scroll-plugin-fontello-css', X_PLUGIN_URL.'css/fontello.css');
}
}
add_action('wp_enqueue_scripts', 'add_x_scroll_style');
function add_x_scroll_script() {
if ($GLOBALS['pagenow'] != 'wp-login.php' && !is_admin()) {
wp_enqueue_script('x-jquery-easing', X_PLUGIN_URL.'js/jquery.easing.min.js', array('jquery'));
wp_enqueue_script('x-jquery-main-scroll-up', X_PLUGIN_URL.'js/jquery.scrollUp.min.js', array('jquery'));
wp_enqueue_script('x-jquery-active', X_PLUGIN_URL.'js/active.js', array('jquery'));
}
}
add_action('wp_enqueue_scripts', 'add_x_scroll_script');
function add_admin_x_scroll_scripts() {
//Register color picker script
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'my-script-handle', plugins_url('js/my-script.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
}
add_action('admin_enqueue_scripts', 'add_admin_x_scroll_scripts');
Hope this helps and if your satisfied with the code kindly update your plugin.
Thanks