Why is jquery-ui-core enqueueing in my footer instead of the header?

Why do you need it in the header? It’s enqueuing in the footer because when it was registered it was set to enqueue in the footer. In wp-includes/script-loader.php: $scripts->add( ‘jquery-ui-core’, ‘/wp-includes/js/jquery/ui.core.js’, array(‘jquery’), ‘1.8.12’ ); $scripts->add_data( ‘jquery-ui-core’, ‘group’, 1 ); The second line forces it to load in the footer. You could deregister the script, then … Read more

Notice that the wp_enqueue_style is not being called correctly!

The problem is that the wp_enqueue_style() call is inside of the category_collapse() member function of the CategoryCollapse() class, and the CategoryCollapse() class is being instantiated by a callback hooked into the plugins_loaded action hook. That means that the wp_enqueue_style() function is attempting to execute at the plugins_loaded hook, which fires before init, wp_enqueue_scripts, and admin_enqueue_scripts. … Read more

How to en-queue bootstrap 4 to theme?

You can use action hook and enqueue script and style to the site. function my_scripts() { wp_enqueue_style(‘bootstrap4’, ‘https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css’); wp_enqueue_script( ‘boot1′,’https://code.jquery.com/jquery-3.3.1.slim.min.js’, array( ‘jquery’ ),”,true ); wp_enqueue_script( ‘boot2′,’https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js’, array( ‘jquery’ ),”,true ); wp_enqueue_script( ‘boot3′,’https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js’, array( ‘jquery’ ),”,true ); } add_action( ‘wp_enqueue_scripts’, ‘my_scripts’ ); If you want to add the scripts after jQuery then you can use the … Read more

Enqueue script in specific page

Inside admin-header.php, there’s the following set of hooks: do_action(‘admin_enqueue_scripts’, $hook_suffix); do_action(“admin_print_styles-$hook_suffix”); do_action(‘admin_print_styles’); do_action(“admin_print_scripts-$hook_suffix”); do_action(‘admin_print_scripts’); do_action(“admin_head-$hook_suffix”); do_action(‘admin_head’); The one to always use it admin_enqueue_scripts, both for stylesheet and scripts. More info in this answer. It has one additional argument, the $hook_suffix. This argument is exactly the same as the return value that you get from add_submenu_page() … Read more

Protocol neutral URLS with wp_enqueue_script (SSL issues)?

You can’t — URLs must have a protocol for WordPress to enqueue them. What you can do, though, is detect which protocol to use and then use that. $protocol = is_ssl() ? ‘https’ : ‘http’; $url = “$protocol://example.com/resource”; But for enqueuing scripts from your theme, you should use get_template_directory_uri() or get_stylesheet_directory_uri() which already handle SSL: … Read more

Enqueue custom font file with rel=”preload”

You could try using the style_loader_tag filter. add_action(‘wp_enqueue_scripts’, ‘my_enqueue_scripts’); function my_enqueue_scripts() { wp_enqueue_style(‘my-style-handle’, “https://wordpress.stackexchange.com/fonts/custom-font-folder/CustomFontFile.woff2”, array(), null); } add_filter(‘style_loader_tag’, ‘my_style_loader_tag_filter’, 10, 2); function my_style_loader_tag_filter($html, $handle) { if ($handle === ‘my-style-handle’) { return str_replace(“rel=”stylesheet””, “rel=”preload” as=”font” type=”font/woff2″ crossorigin=’anonymous'”, $html); } return $html; } Here we’re enqueuing the stylesheet using the normal wp_enqueue_style function. We then capture the … Read more

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