How to dequeue / deregister parent theme style

It is pretty simple: function remove_nada_theme_font_style() { remove_action( ‘wp_enqueue_scripts’, ‘nada_theme_styles’ ); } add_action( ‘after_setup_theme’, ‘remove_nada_theme_font_style’ ); Since the child theme is loaded before the parent theme, you can’t simply remove the action. because the add_action calls in the parent theme will simply overwrite your requests. You have to wrap it into the after_setup_theme hook. This … Read more

Which are the MediaElement.js scripts to enqueue

I had the same issue, but with the audio player. First of all, you need enqueue MediaElement styles wp_enqueue_style( ‘wp-mediaelement’ ); Next you need to add wp-mediaelement as dependency of your app script or enqueue it. wp_enqueue_script(‘wp-mediaelement’); or wp_enqueue_script( ‘app’, get_stylesheet_directory_uri() . ‘/js/app.js’, array( ‘jquery’, ‘wp-mediaelement’ )); As result you need something like that: function … Read more

Adding dependencies to script enqueing

Try this. You have to call wp_enqueue_script at the appropriate time, so that it can queue your scripts until the dependencies you specify are called – add_action(‘wp_enqueue_scripts’, ‘enqueue_my_scripts’); function enqueue_my_scripts(){ wp_enqueue_script( ‘jscripts’, get_stylesheet_directory_uri() . “/scripts/jscripts.js”, array(‘jquery-ui-datepicker’)); echo wp_script_is(‘jquery-ui-datepicker’, ‘queue’) ? ‘<br>’ . ‘[jquery-ui-datepicker] Script is enqueued’ . ‘<br>’ : ‘<br>’ . ‘[jquery-ui-datepicker] Script not enqueued’ … Read more

Enqueue scripts to a specific header-.php?

You load the header file probably with get_header(). There is a hook you can use: ‘get_header’. You get the called header name as parameter. add_action( ‘get_header’, ‘wpse_54865_conditional_enqueue’ ); function wpse_54865_conditional_enqueue( $name ) { if ( ‘my_custom_header_name’ === $name ) { // register your script loading function } }

wp_enqueue_script vs. wp_register_script

I think you should just enqueue the script as well (for your validate script). I would wrap it around one whole function as well to avoid issue #11526: calling out Thus all together: <head> … <?php function mytheme_enqueue_script() { // Load jQuery wp_enqueue_script(‘jquery’); // Load draggable wp_enqueue_script(‘jquery-ui-draggable’); //load your script wp_enqueue_script(‘commonfunctions’, child_template_directory . ‘/script/commonfunctions.js’, array(‘jquery’, … Read more

Problem in wp_localize_script

First of all, you are NOT enqueuing the script.. Try this code, working in my test install. function load_my_scripts() { // Create the localizations array $localize = array( ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ ), ); // Register The Script First wp_register_script(‘custom-js’, get_stylesheet_directory_uri() . ‘/js/custom.js’, array(‘jquery’)); wp_enqueue_script(‘twentyfifteen-custom-js’, get_template_directory_uri() . ‘/js/custom.js’, array(), ‘20141010’, true); // Register the localization … Read more

Remove a script from a template file using wp_dequeue_script

Script dequeuing calls should be added to the wp_print_scripts action hook, like so: add_action(‘wp_print_scripts’,’example_dequeue_myscript’); function example_dequeue_myscript() { wp_dequeue_script( ‘myscript’ ); } This is because scripts are typically enqueued on the wp_enqueue_script hook, which happens early in the wp_head process. The wp_print_scripts hook happens right before scripts are printed, and thus is latest in the process.

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