Dequeue script in template isn’t working

Move your project_dequeue_unnecessary_scripts() function to your functions.php file and add a conditional statement to determine if the appropriate template is being loaded. E.g.: // Remove Mobile Header function project_dequeue_unnecessary_scripts() { if ( is_page_template( ‘name-of-template.php’ ) ) { wp_dequeue_script( ‘enterprise-responsive-menu’ ); wp_deregister_script( ‘enterprise-responsive-menu’ ); } } add_action( ‘wp_print_scripts’, ‘project_dequeue_unnecessary_scripts’ ); I suspect that your function is … Read more

Best spot for wp_register_script() and wp_register_style()

Scripts and styles can be registered on the wp_loaded hook and then later enqueued using wp_enqueue_scripts. Once the scripts and styles have been registered, they can be enqueued later using just the handles that they were originally registered with. // Register scripts/styles. They can be optionally enqueued later on. add_action( ‘wp_loaded’, ‘wpse_register_scripts’ ); function wpse_register_scripts() … Read more

Enqueuing Script in functions.php vs on the page

Go with functions.php. Use the wp_enqueue_scripts action to call this function, or admin_enqueue_scripts to call it on the admin side. Calling it outside of an action can lead to problems. See #11526 for details. Source: http://codex.wordpress.org/Function_Reference/wp_enqueue_script function themename_load_js() { if ( is_admin() ) { return; } if is_page( 123) { // Replace 123 with your … Read more

How can I load script and style in specific page in the back-end?

So simple I will explain it step by step: First, use the $hook variable that is WordPress default like this: function the_themescripts($hook) { echo $hook; } add_action( ‘admin_enqueue_scripts’, ‘dr_theme_options_style_scripts’ ); Now go to custom page in your admin WP Dashboard and at the top you will see something like toplevel_page_your_theme_page_slug if it does not visible … Read more

Custom data-id wp_enqueue_script

script_loader_tag filter was introduced in WordPress 4.1: <?php add_filter( ‘script_loader_tag’, ‘my_script_attributes’, 10, 3 ); function my_script_attributes( $tag, $handle, $src ) { // change to the registered script handle, e. g. ‘jquery’ if ( ‘MY_SCRIPT_HANDLE’ === $handle ) { // add attributes of your choice $tag = ‘<script id=”customID” data-name=”customDataName” src=”‘ . esc_url( $src ) . … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)