Dequeue Scripts and Style for Mobile not working?

You should run the conditional tags (e.g. is_front_page()) from inside the callback/function (e.g. remove_default_stylesheet()) — see Where to Use Conditional Tags and the warning here. And there’s no hook named wp_enqueue_style; just use the wp_enqueue_scripts to enqueue/register/dequeue/deregister a stylesheet file. So I’m not sure the exact conditionals you need, but the following would dequeue/deregister the … Read more

wp_enqueue_script won’t load in header?

Write wp_enqueue_script in wp_enqueue_scripts action function load_kenburns() { if ( !is_admin() ) { wp_register_script( ‘kenburns’, get_template_directory_uri() . ‘/js/bannerscollection_kenburns.js’, ”, ”, false); wp_register_script( ‘jquery-ui’, get_template_directory_uri() . ‘/js/jquery-ui-1.8.16.custom.min.js’, ”, ”, false); wp_register_script( ‘jquery-touch’, get_template_directory_uri() . ‘/js/jquery.ui.touch-punch.min.js’, ”, ”, false); wp_register_script( ‘kbsettings’, get_template_directory_uri() . ‘/js/kenburnsettings.js’, ”, ”, false); wp_enqueue_script( ‘kbsettings’ ); wp_enqueue_script( ‘kenburns’ ); wp_enqueue_script( ‘jquery-ui’ ); wp_enqueue_script( … 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

Pass $this to function nested in another public function of the same class

There are multiple ways to accomplish this. I’m showing you a way that will not fundamentally change how you are doing it: First in My_Plugin class: class My_Plugin { // … private function define_public_hooks() { $plugin_public = new My_Plugin_Public( $this->get_plugin_name(), $this->get_version() ); $this->loader->add_action( ‘init’, $plugin_public, ‘init’ ); // … } // … } Then in … 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 } }

When is it too late to call the action wp_enqueue_scripts?

The function wp_enqueue_scripts— with an ‘s’– is used as a callback to wp_head. All that the function wp_enqueue_scripts does is fire the wp_enqueue_scripts action. So the last time that you would be able to use the action wp_enqueue_scripts is before the wp_enqueue_scripts callback on the wp_head hook. In terms of theme templates, that means you … Read more

Adding scripts to admin page in my theme

Use add_action(‘admin_enqueue_scripts’, ‘pb_admin_style’); and as the manual states, the admin_enqueue_scripts can also be used to target a specific admin page. Use this to only select the admin page you want. function pb_admin_style($hook) { if( ‘edit.php’ != $hook ) return; wp_enqueue_script( ‘my_custom_script’, plugins_url(‘/myscript.js’, __FILE__) ); } add_action( ‘admin_enqueue_scripts’, ‘pb_admin_style’ );

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