Links a script file to the generated page at the right time according to the script dependencies, if the script has not been already included and if all the dependencies have been registered. You could either link a script with a handle previously registered using the wp_register_script() function, ...

learn more… | top users | synonyms

0
votes
0answers
5 views

How to add conditionals for IE browsers between certain versions?

I know that wp_script_add_data and wp_style_add_data are the correct functions for adding IE conditionals. For example, this: wp_script_add_data( 'foo', 'conditional', 'lt IE 9' ); Would get you ...
0
votes
1answer
20 views

Double jQuery loaded

Please help me to understand why this works. I have loaded my jQuery in mu functions.php-file like this: <?php function load_jquery() { wp_enqueue_script( 'jquery' ); } ...
0
votes
2answers
28 views

How to enqueue JavaScripts in a plugin

I am struggling a lot this time working on including a JavaScript files in plugin folder. I am trying to create a plugin by transferring widget files from themes directory. I copied the widget file, ...
1
vote
3answers
48 views

WordPress script file version numbers changing in live environment

I'm registering my javascript files for Wordpress in my functions file as so: if( !function_exists( "theme_js" ) ) { function theme_js(){ wp_register_script('wpbs-scripts', ...
2
votes
1answer
74 views

Remove specific CSS and JS from the head

I'm trying to remove some specific lines from the WP_HEAD. Now my header looks following way: <link rel='stylesheet' id='bootstrap-css' href='/themes/wp-e/css/bootstrap.css?ver=4.2.2' ...
0
votes
1answer
27 views

File not enqueueing

I hate to add to the multitude of "script not enqueueing" questions, but I can't seem to figure out why my "tablesorter" scripts won't enqueue. The other script (customsjs) in the same directory is ...
0
votes
1answer
25 views

WordPress Ajax problem with undefined url

I have problem with wordpress plugin - in jQuery.ajax part, the ajax_object (url: ajax_object.ajax_url) is undefined and I don't know why. I cant recieve correct code from my php plugin, but if I ...
0
votes
1answer
15 views

Enqueue script in header

I'm having issues enqueueing a script in the header. I'm working on a Wordpress site where the page content is loaded via AJAX. To do this I have to enqueue the script with the AJAX call. I do this ...
4
votes
3answers
2k views

What does wp-embed.min.js do in WordPress 4.4?

Question What does the wp-embed.min.js file do? I noticed it is added to the end of my blog page footer. How can I get rid of it? Effort After some googling and I found Embeds on the Codex. Why ...
0
votes
3answers
29 views

Using wp_enqueue_script on scripts that contain PHP

I'm am working on a WooCommerce website, and have all my jQuery in the footer inside script tags. I use PHP to filter out the needed scripts for any particular page. However, I would like to use the ...
8
votes
3answers
153 views

Any advantage of using wp_scripts and is_IE when enqueuing scripts

I read on the WP docs, which pointed to this gist that the correct way to enqueue styles for IE is by using the $wp_styles. I'm guessing that this would be true then for scripts as well. Take these ...
0
votes
1answer
29 views

wp_enqueue_script inside a class static function [closed]

I have searched for a solution of my problem, but without resolution. I have writed a plugin and in init hook I call wp_enqueue_script and wp_enqueue_style. wp_enqueue_style work correctly, ...
0
votes
0answers
19 views

How to implement wp_localize_script with add_menu_page

I have a class Namer and this class adds a menu page (add_menu_page) and this in turn loads CSS and javscript, but I can't seem to load the wp_localize_script to do AJAX calls & Nonce, here is my ...
0
votes
1answer
116 views

Custom Plugin - CSS works, JS doesn't

In the plugin I'm making, I use separate js and css files (____.js, ____.css). This is the first time that I've included an external .js file in anything. I'm registering and enqueueing both in the ...
0
votes
1answer
1k views

registering new jQuery after wp_deregister_script() not working

I have the following in my functions.php and it doesn't seem to load jQuery. If I remove the wp_deregister_script() line it appears to load the wordpress included jQuery and not the one I have ...
0
votes
0answers
19 views

How do I get the full details of a registered/enqueued script?

I'm trying to get the details (such as src, in_footer etc) of enqueued/registered scripts. For example: add_action('init', function() { global $wp_scripts; var_dump($wp_scripts->queue); ...
0
votes
2answers
970 views

How to add JavaScript file using wp_enqueue_scripts?

I have made a very simple JavaScript script. There is 1 .js file with a lot of code, and in the HTML file there is only 2 lines. The script works fine when I test it on a plain HTML page, but when I ...
8
votes
3answers
3k views

Enqueue Scripts / Styles when shortcode is present

What is the idea way to register/enqueue scripts and/or styles for use in plugins? I recently made a plugin simple plugin to add the user avatar/gravatar with a shortcode. I have different style ...
5
votes
2answers
3k views

How do I implement the Wordpress Iris picker into my plugin on the front-end?

This question here is asking the same question as I am, but there were no adequate answers nor a selected correct answer so I am asking again hoping if I ask in a more coherent manner I might get a ...
1
vote
1answer
1k views

Only let plugin add actions to wp_head & wp_footer on single posts

I'm using a a plugin (Comments Evolved) on a recently built site. The issue I'm having is that this plugin globally enqueueing and adding actions to the head and footer of all pages. I'd like to ...
3
votes
4answers
1k views

Enqueue script only for IE

I want to use dd belatedpng so the PNG's on my website appear properly on IE. The script I've always used on non-wordpress websites was <!--[if lt IE 7 ]> <script ...
-2
votes
3answers
2k views

Why does wp_enqueue_script ignore my 'wp_head' hook?

I would like css_head_scripts and js_head_scripts to be appended to wp-head but Wordpress completely ignores it? Am I missing something? function css_head_scripts() { wp_enqueue_style( ...
2
votes
5answers
4k views

Asynchronous Javascript Loaders

I'd like to take advantage of loading my scripts while the page is loading. ie. Yepnope, head.js etc... But I also want to be able to enqueue the script so other plugins don't try adding their own. ...
0
votes
2answers
2k views

Deregister scripts on unnecessary pages using remove_action

To all would-be close-voters: This question is not a duplicate, because I need to remove all scripts added by plugin using remove_action. In Very stubborn wp_register_script / add_action vs ...
0
votes
3answers
47 views

How to load JS and CSS only on specific Pages using is_page()?

I am building my first WP plugin, it should load some JS and CSS files only on specific pages selected through a form available in the plugin Admin area. Once selected in the form, Page Title gets ...
4
votes
2answers
3k views

Enqueue script in specific page

I am building a wordpress theme with a theme dashboard with options, but as I read somewhere, the enqueue script code I am using just enqueues it in the backend but it loads in every page in the ...
0
votes
2answers
35 views

Enqueue script in plugin is not working

I can't figure out why this script wont load on site. Am I missing something? function ajax_follow_enqueue_scripts() { wp_register_script('follow', plugins_url('the-follow.js', __FILE__)); ...
0
votes
1answer
32 views

Enqueue script: link not working in page source

I am using the Front-End Editor plugin of Scribu at my website. I want to enqueue it, because I want to use it alongside my caching plugin, but that one only works when JS files are enqueued. The ...
1
vote
5answers
4k views

wp enqueue script using scripts from cdn with a safety callback

I want to include several scripts and styles from a remote CDN... in this case bootstrap and similer files but i want to provide a safety net in the form of a callback in the case the CDN is down for ...
0
votes
2answers
32 views

Enqueue scripts to footer

i know how i can print a single script with wp_dequeue_script and wp_enqueue_script to the footer: function dequeue_my_scripts() { wp_dequeue_script('dgx_donate_paypalstd_script'); } add_action( ...
1
vote
2answers
44 views

How do I load custom scripts and styles for a page?

Different pages often need different set of scripts and styles for them. I use functions.php and construction like this to load scripts and styles: function load_assets() { wp_enqueue_style( ...
0
votes
1answer
27 views

Enqueue script, taking no effect [closed]

I've added my custom_script.js to my child theme by making a /js folder, and I added it within my functions.php like this: /*** Make Header Shrink on Page Scroll**/ add_action( 'wp_enqueue_scripts', ...
0
votes
1answer
37 views

JavaScript and Google PageSpeed + wp_enqueue_script

The best theme in WordPress theme development requires a standard protocol of enqueuing scripts through wp_enqueue_script, but this doesn't solve the problem and Google PageSpeed suffers. I found a ...
1
vote
2answers
37 views

wp enqueue, how to prevent duplication when same script is registered with different handles

I read that wp enqueue prevents duplicate script to be loaded. But, what happens when same script ( say bootstrap.js) is loaded by 2 different plugins with 2 different handles using wp enqueue ?
0
votes
0answers
52 views

Javascript file doesn't load

I have a mysterious problem - the script file isn't loaded. The same code works on a test server. But when we uploaded it to the live server and looking at the browser console at "sources", it didn't ...
0
votes
1answer
112 views

Which are the MediaElement.js scripts to enqueue

I'm loading (paging) posts with ajax, so I want to be able to render videos using MediaElement.js on newly appended content. I already have my script working but is failing if no video posts are ...
0
votes
0answers
17 views

add inline javascript like wp_add_inline_style

How can I add an inline js right after my selected enqueued file? like we can do with inline_style I want to add noconflict to an external jquery file (through cdn)
8
votes
6answers
4k views

Adding Additional Attributes in Script Tag for 3rd party JS

I ran into this when attempting to integrate Dropbox's drop in chooser API to a plugin I'm writing. The API documentation instructs you to place the following script tag at the top of your file: ...
0
votes
0answers
30 views

Admin - Dequeue unnecessary scripts/styles

Currently, I'm working on a plugin where I use custom post type. In each post type edit page I've got meta data fields to set advanced functionalities. However, because the interface needs to take ...
0
votes
2answers
33 views

Include script files for admin submenu page

I created a sub page to "users.php" where I can add a user in a customized way. I used a lot of the code from "user-new.php". However, user-new.php seems to rely on some javascript file to display the ...
7
votes
1answer
420 views

Loading a script with a dependency, is unloading another script's dependency

First, I'm aware that my question is happening in the context of my work with the WooCommerce plugin, which would normally make it off-topic. However, I think my question relates to wp_enqueue_script, ...
0
votes
1answer
36 views

Enqueue script not working

This is my code to enqueue scripts. The later one with title yourscript2 is working, but the first one with title upload is not working: add_action( 'wp_enqueue_scripts', 'add_my_script' ); function ...
0
votes
0answers
89 views

Gravity Forms loading jquery

I placed the following script in my functions file to deregister Wordpress jquery and use the Google CDN. // use the Google hosted jquery library if (!function_exists('modify_jquery')) { function ...
0
votes
1answer
4k views

wp_enqueue_script() not working at all

I'm trying to enqueue JavaScript files using wp_enqueue_script(), but it isn't working at all. Here is my code: function load_css_js() { wp_enqueue_style('gdgt-base', get_template_directory_uri() ...
0
votes
2answers
61 views

Enqueue js script to footer

I need to run wp_enqueue on javascript files after the DOM has been populated because I need to target a div. EDIT I am trying to add the following three scripts: wp_enqueue_script('react_js', ...
1
vote
3answers
61 views

Why isn't jQuery 2.1 loading in the header?

Because I want to use jQuery 2.1 instead of 1.11, I first have to de-register jQuery. Then register it with the new values. : add_action( 'wp_enqueue_scripts', 'add_scripts' ); function ...
1
vote
2answers
77 views

Searching multiple tags and adding jQuery dependant script onto page template?

I have this simple javascript file for checking boxes in a tree view menu: treeview.js $(".acidjs-css3-treeview").delegate("label input:checkbox", "change", function() { var checkbox = ...
27
votes
8answers
11k views

Conditionally Loading JavaScript/CSS for Shortcodes

I released a plugin that creates a shortcode and requires a JavaScript file and a CSS file to load on any page that contains that shortcode. I could just make the script/style load on all pages, but ...
0
votes
2answers
44 views

Enqueued Stylesheets Effecting Admin Styles

I'm building a custom theme for a client and I've been adding stylesheets incorrectly for a while, so I decided to do it the correct way :-). However, when I add the stylesheet to my functions.php ...
0
votes
1answer
40 views

Enqueue less file not working in child theme?

In my child theme I have: add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . ...