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
234 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
551 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
277 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
1answer
807 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
158 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
38 views

Execute only on a certain page

I"m trying to get the block of code below to load only when it's the contact page but it doesn't seem to wotk. Any ideas what the problem could be. Still pretty much new to PHP. if ...
1
vote
1answer
51 views

How resource intensive is wp_register_script()?

I'm trying to use the has_shortcode() function to only load certain scripts when there is a shortcode in the post's content, with this code: wp_register_script( 'shortcode-js-file' , FILE_URI, array( ...
1
vote
1answer
118 views

How to add parameter to wp_enqueue_script?

I have the situation that I need to include special scripts only in case a parameter in a macro is used. For the background, see the following: My plugin ChessTempoViewer which wraps a JavaScript ...
1
vote
1answer
60 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
37 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
605 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
1k views

Adding Colorpicker Field To Category

I want to add a custom field to my categories where the user can color code them. I've added the field but I want to use built in colorpicker (either tinyMCE or the farbtastic) to give the user an ...
1
vote
1answer
166 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
266 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
2k 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
69 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
281 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
95 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
217 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
815 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
2k 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
317 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
115 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
104 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
272 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 ...
1
vote
1answer
793 views

Is there a way to list all the JavaScript scripts that are actually loaded by WordPress? Do we care?

This page on the Codex gives us a list of all the default scripts that ship with WP. But how do we know which ones are actually being used so we don't have to manually enqueue them? Or do we care, and ...
1
vote
2answers
1k views

jQuery UI AutoComplete & wp_enqueue_script

I looked at the included scripts in WordPress (wp_enqueue_script) and didnt find what I should include to use jQuery UI Autocomplete I am using it in the admin area. Should I just include jQuery UI ...
1
vote
3answers
282 views

Adding a Javascript slideshow to the home page

I'm trying to add a Javascript slide show to my WordPress home page. In my theme folder I have a js folder and then in that I have jquery.cross-slide.min.js and jquery.min.js. This is what I have and ...
1
vote
1answer
60 views

Using multiple versions of jQuery while still calling it like WP likes

I have two JS plugins inside my plugin. One uses jQuery 1.7.1 and the other 1.9.1. I need to have each of them use different version. This is how things are at the moment: Plugin php file: ...
1
vote
1answer
85 views

How to load library scripts in admin from plugins in noConflict wrapper?

For my plugin I need to make a meta box for some custom fields in my CPT (xyz), and to organize the fields, I need to implement tabs. And I's taught to load jQuery/JavaScripts using ...
1
vote
1answer
52 views

Wordpress Scripts Being Loaded in Footer

I've bought a theme for a Wordpress site. I noticed that the theme author has added the javascript to the footer for load time, but as I use Gravity forms, I understand that some of scripts need to ...
1
vote
0answers
59 views

How to modify default controls in Wordpress theme customizer

I'm trying modify the default control in the wordpress theme customizer specifically the action for the close button. By default clicking it will make you go back to the themes page, but I want it to ...
1
vote
1answer
138 views

Image LazyLoad plugin not loading jQuery dependancies with wp_enqueue_script in WP 3.3.1

I am attempting to install the image LazyLoad plugin with use on my Wordpress 3.3.1 blog. I have followed the basic instructions, so it is installed and activated on my development site. The ...
1
vote
0answers
62 views

Dequeue script conditonnally

Was thinking about this : dequeue or enqueue scripts with IE for example. They say we can use global $is_IE; but that's wrong simply because it's not compatible with caching. Nowadays cache is ...
1
vote
0answers
15 views

How to enqueue script or style in a theme's template file? [duplicate]

I am making a template for the page which will contain a slider. Can anyone share some advice with me of how to go about it?
1
vote
1answer
67 views

Proper way to enqueue a generated script that isn't in a .js file?

What's the proper way for loading a script via WordPress that isn't in a .js file? I'm generating some javascript on the fly based on some field options in a plugin. I want to load it into the page, ...
1
vote
0answers
329 views

Adding wp_enqueue_media(); causes problem

I want to add the media uploader in the theme options page. If I add following code in the options page, the media uploader works fine there, but it creates problem in the standard posts featured ...
1
vote
1answer
137 views

Enqueueing Script to footer puts it at the very bottom

So I've got a bit of an issue, and not sure what the problem is. I'm trying to enqueue javascript in the footer of my Wordpress site. The footer looks like this: </footer> </div> ...
1
vote
1answer
628 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 ...
1
vote
0answers
421 views

Getting jquery to work with custom theme

I am trying to get some jquery plugins to work with my custom theme. Up until now I was doing this: function my_scripts_method() { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', ...
1
vote
0answers
59 views

How to load script-related styles automatically?

Scenario: It is common that a JS dependency is bundled with a style file to work properly (just think about your favorite slideshow jQuery plugin). AFAIK, in this situation, the script and style have ...
1
vote
0answers
136 views

Is it possible to enqueue the Youtube API script or does it have to be inline?

The code below is the main part of a function in my functions.php which returns a div and script which ultimately output a youtube API iframe to the template where the code had been called from. At ...
1
vote
1answer
143 views

Possible to enqueue scripts and CSS to Multisite Network dashboard?

Is it possible to enqueue scripts and css only to the Network Admin Dashboard? To edit the network admin menu, you have this hook: network_admin_menu, so I also tried network_admin_enqueue_scripts, ...
1
vote
1answer
400 views

Move jQuery to the bottom of the page whilst keeping the WordPress jQuery

I wish to move jQuery to the bottom of the page on my theme, to speed up loading times. Previously I was doing this by replacing it with Google's CDN version but I have been told that is a bad thing ...
1
vote
1answer
407 views

issues with wp_enqueue_script in my plugin

So I am working on a plugin and am trying to trigger a js file whenever a post is saved. I have been reading up on this all morning and cannot seem to find why this is not working. Any advice? If I ...
1
vote
0answers
255 views

How to correctly make admin pages for custom tables which don't show in the menu? [closed]

I have to create a custom table to store data for a client because they want a very precise search capability. I already have this working with custom post types and using custom fields, but with 800+ ...
1
vote
1answer
58 views

wp_enqueue_scripts wont load my scripts

I am trying to add my custom scripts to my project but can seem to get them to load. I've never had this issue and am stumped. This is what I have in my functions.php: function ex_scripts() { ...
1
vote
3answers
328 views

Loading scripts to the Post Edit page only

I have added a few meta boxes for the posts and pages, so I want to load a js script only on the Create/Edit post and page. How can I do that? Currently I'm using following but that loads the scripts ...
0
votes
3answers
2k views

How to enqueue jquery in admin and why is it not already there?

Why does the jquery below not fire? Its going to the "else" every time. if ( is_admin() && $pagenow == 'theme-install.php' && $_GET['tab']=="upload"){ ...