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

1
vote
1answer
57 views

Do we have to register JQuery if we want to use it in wp_enqueue_script()?

Or is it registered by default? I am enqueuing a script with wp_enqueue_script() wp_enqueue_script('validation', 'http://domain.com/wordpress/wp-content/themes/theme/js/validation.js', ...
1
vote
1answer
49 views

Prioritizing wp enqueue scripts error

I wanted to load the following two scripts before any other script so I added priority 1 and 2, however I am getting an error. I read it on a tutorial that this is how to prioritize ...
1
vote
1answer
46 views

Overriding a function in wordpress

A theme that I bought is adding unnecessary inline JS code that is not needed in the front page. /* Scripts - dynamic css */ add_action('wp_footer', 'upme_custom_scripts'); function ...
1
vote
1answer
264 views

Trying to add script to specific admin page is not working

What I am trying to achieve is to load a .js file on an edit.php page, however the code is not working specifically for this page. I've applied the same code type of code to other CPT pages, but for ...
1
vote
1answer
137 views

Problem with wp_enqueue_scripts in plugin

I've created the following plugin which requires a js library, however attempts to load the plugin with the line add_action( 'wp_enqueue_scripts', 'calc_script' ); in place fail with the error ...
1
vote
2answers
164 views

Avoiding Duplicate function names in Post Loop (WP_Footer script)

Say I created a plugin that injects content (used as a shortcode) into a post. I'm trying to push that code for each post to the bottom of the page. This works fine, however when you are on an ...
1
vote
1answer
1k views

force enqueue script to be first in order of prominence

I have a few scripts which are being enqueued, the problem is that I want to force the order of prominece to which these scripts are loaded. There is one in particular which is loaded from a plugin ...
1
vote
2answers
243 views

Enqueued scripts and styles loading in WordPress Dashboard as well

For a moment, I wondered if my test site got hacked -- my WordPress site's dashboard was all broken (cosmetically). But when i looked at the source code of the page, I noticed that the "scripts and ...
1
vote
1answer
248 views

Enqueue script with url_query variables?

Is there an easy way to enqueue a JavaScript file with url_query values populated? I have a php file underneath my js directory with JavaScript headers that I want to generate some dynamic JavaScript ...
1
vote
1answer
152 views

getting a js file for one page

wp_register_script('SliderViewer', '/js/SliderViewer-1.2.js'); wp_enqueue_script('SliderViewer'); get_header(); however, mydomain.com/js/SliderViewer-1.2.js doesn't exist. My js is in the ftp at ...
1
vote
3answers
2k views

using wp_enqueue_script to attach jquery-ui

I am trying to load jquery-ui using wp_enqueue_script. I can check that jquery is loaded. jquery-ui is registered i.e. output of var_dump( wp_script_is( 'jquery-ui-tabs', 'registered' ) ); is ...
1
vote
1answer
113 views

wp_enqueue_script & constants?

I'm enqueuing a script: wp_enqueue_script('my-script', MY_SCRIPTS."/my-script.js"); How to get MY_SCRIPTS const working in this context? I know this works: $template_dir = ...
1
vote
1answer
356 views

enqueue the scripts

I have a template that has been hardcoded in the header and it needs to be Enqueued. I don't know what to do and the template provider is giving me the run around. JQueries won't work because of it. I ...
1
vote
2answers
214 views

How do you enqueue a Visual Basic script using wp_enqueue_script?

Internet Explorer will have errors with VB script files en-queued using wp_enqueue_script. This is probably because the output of enqueue script set the script type to 'language/javascript'. Are ...
1
vote
1answer
59 views

Enqueue Wordpress plugin scripts below all other JS

I am developing a simple Wordpress app but I am having an issue as all of the plugin scripts are rendered before those which are enqueued in my functions.php. Here is a sample section of the ...
1
vote
1answer
85 views

Where to call wp_enqueue_script in a plugin with custom template?

I am writing my first plugin and I have this code in the main plugin php to replace home page with custom template add_filter( 'template_include', 'replace_home_page' ); function replace_home_page( ...
1
vote
1answer
88 views

How to undo deregister script and use local versions?

The WordPress theme I am using deregisters the jQuery and jQuery UI libraries and registers google-hosted versions instead of the libraries from wp-includes. Here is the code in `functions. UPDATE: ...
1
vote
1answer
343 views

Including style.css in Child Theme

Twenty Thirteen uses wp_enqueue_style( 'twentythirteen-style', get_stylesheet_uri() ); in functions.php. Wheter I use it or not use it in twentythirteen-child/functions.php the style.css from Child ...
1
vote
1answer
608 views

wp_head() - list hooked actions with priorities?

I'd like to add something to wp_head() but I'm aiming precise location (like after style.css but before rtl.css and before my other custom script). I'm wondering if it's possible to list everything ...
1
vote
2answers
194 views

Adding dependencies to script enqueing

What is the point of the dependencies parameter when using wp_enqueue_script()? For instance, when I do the following: wp_enqueue_script( 'jscripts', get_stylesheet_directory_uri() . ...
1
vote
1answer
332 views

wp_enqueue_script Doesn't Work?

It's pretty standard, I enqueue script and style for admin page. function admin_custom(){ wp_enqueue_script('js', plugins_url('adm.js', __FILE__)); wp_enqueue_style('css', ...
1
vote
2answers
93 views

Enqueueing Scripts on a Custom Top-level Menu Page

I've created a menu page using the following function: add_menu_page( 'Nonpareil options', 'Nonpareil options', 'administrator', 'nonpareil_theme_options', 'nonpareil_theme_display' ); ...
1
vote
1answer
276 views

How do I get my page to load the jQuery UI Effects library?

I'm using javascript for the first time to do some simple animations on the home page of my website. So far I have added the following to my header.php file (which is only used for my home page), ...
1
vote
2answers
160 views

Register and load scripts

In my functions.php function load_scripts() { wp_enqueue_script( 'jquery' ); wp_register_script( 'modernizr', get_template_directory_uri() .'/js/modernizr.foundation.js' ); ...
1
vote
1answer
986 views

How can I enqueue protocol relative external (//ajax.googleapis.com/…) scripts?

According to the Codex, wp_enqueue_script supports protocol relative, or protocol agnostic external links: "Remote assets can be specified with a protocol-agnostic URL, i.e. ...
1
vote
1answer
361 views

wp_enqueuescript won't load in footer even with true value set?

Below is my code for enqueue my scripts and css. I am trying to get the JavaScripts to load in the footer of my site, but when I view source I see them loading in the header. I suppose the "true" ...
1
vote
2answers
673 views

Is there a way to set the order of wp_footer hooked functions?

I was wondering if we can set the order of a function hooked to wp_footer(), I created a function that echos: <script> ajsfunction(); </script> and I also enqueued the js file of this ...
1
vote
1answer
175 views

Is it recommended to pass some data to scripts in `wp_enqueue_scripts`?

I have on many occasions used wp_enqueue_script to pass some 'query variables' to scripts like this: function my_enqueue_scripts(){ $tempurl = urlencode( get_bloginfo( 'template_url' ) ); ...
1
vote
2answers
489 views

Best way to include jQuery and fire with script at bottom of container

I'm going to be using a jQuery slider on my homepage only (not a WP plugin, but a third party). What I'd like to do is include jQuery, the plugin's jQuery script using a .js file, then include the ...
1
vote
1answer
233 views

Execute script only on certain admin pages

To solve this problem i've used this in my js file: var location = String(window.location); //only runs in post.php and post-new.php if(location.search('post.php') != -1 || ...
1
vote
2answers
1k views

How to control what jQuery version to include, with wp_enqueue_script

I'm using a script that is based on jQuery, so I'm not enqueue-ing jQuery directly, but via passing it in the array of dependent scripts: ...
1
vote
1answer
731 views

Enqueue Style for a page/pages only

it is causing problem because i did not do it before. I am trying to enqueue style or may be scripts depending on page. But it not working. Here is the code: add_action('init', 'my_enqueue_styles'); ...
1
vote
1answer
7k views

How to link external javascript files?

I am working on a custom Wordpress theme for my bosses website. I have everything working perfectly so far except for one thing... the external javascript files will not work. I followed the exact ...
1
vote
1answer
155 views

Replacing Scripts in Admin Load_Scripts

I'm currently creating a plugin that requires me to overwrite one of the Wordpress admin panel javascript files. I have recreated the file with the changes, I need to know how to replace the existing ...
1
vote
1answer
40 views

Enqueue Wordpress jQuery after it's been deregistered by a plugin

I'm looking after a Wordpress install that makes use of a plugin that deregisters jQuery and replaces it with it's own ancient version. I'm aware of why loading your own jQuery is irresponsible and ...
1
vote
1answer
30 views

Not sure if enqueuing js scripts properly

When I put this code right above the closing of my body tag it works, but when I try to enqueue it, it breaks. I'm thinking maybe jQuery isn't getting called? The snippet is from here FUNCTIONS.PHP ...
1
vote
1answer
156 views

Enqueue Google CDN jQuery in Footer

I'm trying to enqueue jQuery from Google's CDN and have it called in the footer rather than the header of my theme. Here's my code: wp_deregister_script('jquery'); wp_enqueue_script('jquery', "http" ...
1
vote
1answer
69 views

if file_exists not working with wp_enqueue_style

Inside a function I'm doing something like this: $optional_css_exists = get_template_directory_uri() . "/css/optional.css"; if ( file_exists($optional_css_exists) ) { ...
1
vote
1answer
137 views

When is it too late to call the action wp_enqueue_scripts?

I'm creating a plugin that always enqueues a script in the footer. I also have a function that if called would enqueue an additional script that depends on the other one. Here is the basic format of ...
1
vote
1answer
951 views

jquery-ui-autocomplete is not loaded with wp_enqueue_script

when I load the default jquery-ui-autocomplete script from wordpress via wp_enqueue_script( 'jquery-ui-autocomplete', '', array( 'jquery-ui-widget', 'jquery-ui-position' ), '1.8.6' ); it is ...
1
vote
2answers
58 views

Enqueue never runs

My enqueue scripts are never called I can't figure out why. All my paths are correct and I'm assuming the code is correct Functions.php function tim_enqueue_default_scripts() { if (ENVIRONMENT ...
1
vote
1answer
144 views

Can't load JS File

I'm trying to load two JS files. But some how its not working. Tried both of these, and the console window doesn't complain of unable to load the file, it never was in the head. Also, I'm having a ...
1
vote
1answer
84 views

Enqueue AWS Script

I am working on the integration of an Amazon Webstore (Amazon Checkout) on a WordPress site using Amazon Documentation here. Has been a while since I worked with enqueueing external JScripts. I need ...
1
vote
2answers
204 views

Adding scripts to admin page in my theme

In functions.php of my theme I have code to add page in admin area and append scripts to it. But scripts are not loaded. Bellow is code. Commented out add_action lines are the one I did check. // ...
1
vote
1answer
503 views

Which action to hook wp_enqueue_script to? wp_head or wp_enqueue_scripts? [duplicate]

Possible Duplicate: Where is the right place to register/enqueue scripts & styles According to wp_enqueue_script() documentation in Codex, it seems that one should hook ...
1
vote
3answers
1k views

How do I force wp_enqueue_scripts to load at the END of <head>?

I am loading scripts via wp_enqueue_scripts in my child theme. The only problem is that my style.css script get loaded BEFORE plugin scripts, yet I need to override the css in the plugins with my ...
1
vote
2answers
241 views

Script won't load via plugin class

I'm not sure why this script is not loading or producing any load errors via Firebug. Here is my plugin script: class AV_Slideshow{ function __construct(){ $this->hooks(); } function ...
1
vote
2answers
100 views

Enqueue scripts to a specific header-<name>.php?

I've multiple header files (header-name.php), they are mainly being used by different custom post types. Is there any way to enqueue script to only a specific header? At this moment I'm targeting it ...
1
vote
2answers
97 views

Making a plugin only available on the front-end for the logged in super admin

I made a little plugin that enqueues 1 .js file and 1 .css file into a theme's front-end. All it does it load a grid on top of the theme so I can visualise the design. If this plugin was activated ...
1
vote
1answer
243 views

Help with enqueing scripts in footer after init action

In my functions.php, I have set a register_scripts() and load_scripts(), and hooked them to the 'init' action. I have registered all the scripts to be loaded in the footer, in order to optimize page ...