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

2
votes
1answer
2k views

Wordpress Enqueue for homepage only, functions.php, wp-framework

I'd like to replace my: if(is_home()) { wp_enqueue_script( 'homestuff', get_theme_part( THEME_JS . '/home.js' ), array( 'jquery' ), null, true ); wp_enqueue_script( ...
8
votes
3answers
5k views

How to enqueue scripts on custom post add/edit pages?

I'm trying to enqueue a JS script only when someone is adding or editing a custom post type I created called "recipes". Currently the script works ok when I do this: if (is_admin()){ ...
1
vote
1answer
250 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 || ...
0
votes
1answer
674 views

What to include to use jQuery UI Auto Complete

I was looking at the scripts included with WP and dont see what I can include to use jQuery UI Auto Complete. What do I use? I tried including the whole jQuery UI from Google CDN and auto complete ...
27
votes
1answer
5k views

Where is the right place to register/enqueue scripts & styles

I am using WordPress 3.1.4 by now. I am confused with where (which hook) do I use: to register and/or enqueue scripts and styles on front- and back-ends? Questions: Which are right hooks to ...
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 ...
2
votes
2answers
2k 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: ...
5
votes
7answers
5k views

wp_enqueue_script adding conditional statement not working

This is the code im using in my functions file: add_action('init', 'sort_out_jquery_pngfix_frontend'); function sort_out_jquery_pngfix_frontend() { global $wp_scripts; if(!is_admin()) { ...
22
votes
7answers
8k 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 ...
4
votes
4answers
590 views

Why are admin scripts not printed

I am trying to enqueue/print scripts in the admin area. But they dont seem to appear. add_action('admin_init', function() { add_meta_box('portfolio-meta', 'Details', 'portfolio_metabox_details', ...
3
votes
3answers
132 views

Why does this line of code make photo albums appear?

In a theme I built from scratch I'm using the WP Photo Album Plus plugin. Per some books I've been using as guides, I need to include this code in the header in order to make comments work in a blog: ...
2
votes
1answer
183 views

Adding Scripts in the Admin Area

I'd like to enqueue scripts only for an admin page that I've created. There's an example of this here: ...
3
votes
2answers
730 views

Correct place to register and enqueue scripts

I'm queueing several scripts in my themes Functions.php: if ( ! function_exists('b99_init_scripts') ) : function b99_init_scripts(){ if ( !is_admin()){ ...
0
votes
3answers
1k views

Loading scripts & styles from a meta box callback function

Case: I got a set of classes that build form fields based on data from an input array. The class can build the following types of form fields: input (basic, hidden, password) textarea radio ...
4
votes
2answers
1k views

Using wp_enqueue_script on shortcode function handler

I have this code function this_is_my_shortcode(){ wp_register_script('per-pas-belanja-online', plugins_url('js/per-pas-belanja-online.js', __FILE__), array('jquery'), '1.0.0'); ...
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 ...
2
votes
2answers
161 views

Inserting JS snippet in the footer if there is no wp_footer?

I wrote a plugin which uses wp_enqueue_script() which will include the snippet in either the header or footer depending on the parameters you pass it. The in_footer parameter works great - if the ...
3
votes
2answers
1k views

How can I de-register ALL styles all at once? And same with Javascript?

How can I get all enqueued styles or scripts and then deregister them all at once?
1
vote
1answer
769 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'); ...
2
votes
4answers
4k views

How wp_enqueue_script works?

I am trying to get scripts via wp_enqueue_script();. I have tried this in header but WordPress is not importing any script. I am using like this wp_enqueue_script('jquery'); ...
2
votes
4answers
3k 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. ...
3
votes
3answers
2k views

Is this a bad implementation of wp_enqueue_script for conditional usage?

Conditionally Including scripts whether js or css in xhtml document head...has been a generally tricky affair, especially if you want to enqueue something, based on a shortcode or custom meta field or ...
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 ...
0
votes
1answer
550 views

Yoast SEO breaking media upload

I have a very simple site that I've modified a very small amount. After installing the Yoast SEO plugin I found that it broke the in post media attach/upload. I'm about 80% sure it's related to Jquery ...
0
votes
1answer
104 views

custom fields cannt be seen with version 3.1

I had a Theme that worked OK with ver 2.7. Now that I upgraded to 3.1; I cannot see the "custom fields" in the posts(may be hidden??). Can someone help.Thanks
1
vote
2answers
5k views

wp_ajax() question.. not using wp_enqueue_script?

hey guys, weird situation... I'm trying to use wp_ajax() for the first time. I'm normally using a normal jQuery ajax request but in my current case I get a lot of bugs so I thought about trying ...
0
votes
2answers
582 views

Loading a newer version of jQuery within WordPress

I've read about the WP enqueue_script() function, but if I wanted to use a newer version of jQuery than what my WP installation is using, can I load it through this & WP will use the latest ...
0
votes
1answer
963 views

Calling multiple scripts using wp_enqueue_script

I'm trying to call multiple JQuery scripts using wp_enqueue_script. The call to JQuery works perfectly but the second call to cufon doesn't. I'm not a php or javascript expert - could anyone lend a ...
0
votes
2answers
2k views

How do I get a child theme to load scripts from the parent theme?

Pretty new to WordPress functions, so apologies if this is basic stuff. I've designed a parent theme that registers and enqueues two scripts like so: if ( !function_exists( 'scherzo_scripts' ) ) ...
2
votes
3answers
1k views

How do I activate jQuery/script on demand?

I am trying to use jQuery to display the comment-section of my Wordpress-pages, but without requiring that jQuery be present on all pages that allows comments. Basically, I need the following: A ...
16
votes
3answers
4k views

Check if a script/style was enqueued/registered

Is it possible to test whether a script or a style was registered using wp_register_script/_style or wp_enqueue_script/_style? All functions doesn't return a value and I'm completely clueless. I ...
0
votes
1answer
335 views

What's a good way to unenqueue all scripts for a single template page?

I've found that my attachment templates are inheriting the enqueued scripts for single posts. My first instinct was to unenqueue these scripts one-by-one or to do an is_attachment() check before ...
0
votes
1answer
713 views

convertEntities() used before it is defined

I have an error generated from thickbox loading on every page including the admin area. This is being printed into the html <script type='text/javascript'> <![CDATA[ */ var thickboxL10n = ...
0
votes
1answer
472 views

Run a jquery script on on a certain template page

All I want to do is basically this: wp_register_script( 'jquery_zebra', get_bloginfo('stylesheet_directory') . '/library/scripts/jquery.zebra.js', array('jquery')); wp_register_style( ...
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 ...
0
votes
1answer
452 views

Load scripts only for selected template

Is there a built in function to load scripts only for particular template? At them moment I am doing like so: if (is_page('portfolio') || is_page('gallery')){ wp_register_script('jScrollpane', ...
0
votes
1answer
620 views

Is there a filter for enqueue script to strip the type=“text/javascript” property

script type="text/javascript" is optional in HTML5 and all browsers (even old ones) recognise JavaScript without it. I am building an HTML5 site and want my script output to be consistent. However, ...
12
votes
4answers
1k views

Could the WP script/style loader be used to concatenate and gzip scripts and styles in the front-end?

WP has a nice javascript loader included in wp-admin: http://core.trac.wordpress.org/browser/tags/3.0.4/wp-admin/load-scripts.php and a CSS loader: ...
2
votes
6answers
853 views

WP script versioning breaks cross-site caching?

I am loading JQuery from the google CDN using the following code: wp_deregister_script('jquery'); wp_register_script( 'jquery', // handle - WP uses this name to refer to script ...
6
votes
4answers
5k views

How to use Head JS with all enqueued scripts?

I want to load head js first and then all enqueued scripts into it's function. Like so... <script src=">/js/head.load.min.js" type="text/javascript" charset="UTF-8"></script> ...
11
votes
5answers
17k views

How to correctly include jquery-ui effects on wordpress

I've been trying to include the jquery ui effects (more specifically the shake effect) on my wordpress theme. So far, I've only been able to include the jQuery script, but I really have no clue where ...
2
votes
3answers
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 ...
0
votes
2answers
402 views

Use of CONSTANT in wp_enqueue_script not possible?

I got the following setup: Parent & Child Theme (Parent contains basic stuff, but no loops, style, etc.) inside the functions.php of the Parent Theme i call my init.file, that cares about ...
2
votes
3answers
542 views

wp_enqueue_script + how to load JS or CSS in one URL merge call?

Is there any proper wordpress way of including the JS and CSS through one merged URL? So that instead of loading in x number of separate calls for each JS asset, it can be all merged into one URL? ...
1
vote
2answers
217 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 ...
6
votes
2answers
4k views

How to dequeue a script?

Wordpress has wp_enqueue_script() but not a wp_dequeue_script() function, so what would be the best way to dequeue a script? I'm using LAB.js to load all of my scripts rather than enqueueing them ...