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
2answers
130 views

JavaScript enque stopped working

Somewhere along the line I have messed up my js enqueue I am not sure how. I have the following in my functions.php file and I am including <?php wp_footer(); ?> in my footer.php before the js ...
8
votes
5answers
6k views

Including jQuery and JavaScript files the correct way

I'm having some trouble with this. I'm not sure how to do it the correct way, and I read so many different techniques and ways to do it that I don't know what to make of it. Some questions and ...
4
votes
1answer
2k views

wp_enqueue script my_javascript_file in the footer

I am trying to place my_javascript_file in the footer. According to the documentation $in_footer is the fifth value and it is a boolean so I have it set to true. Currently it doesn't show up anywhere, ...
0
votes
1answer
544 views

wp_enqueue_script not loading my custom js file

I am using the following code below in my functions.php, However app.js is not found when I inspect it in the resources tab. It is looking for it in ...
0
votes
2answers
413 views

thickbox never gets called (weird behavior)

I have the exact same files (except for wp-config) running on a local server and a test server, and in my functions.php I have this: function len_scripts() { if (!is_admin()): ...
0
votes
1answer
424 views

unable to wp_enqueue_script('suggest');

i'm not able to enqueue the built in autosuggest script in my wordpress theme. wp_enqueue_script('suggest'); my current workaround for that problem is to deregister, register manually an then ...
0
votes
1answer
91 views

How can I print out a single stylesheet or javascript link?

I know I can use enqueue_script and enqueue_style to register scripts and stylesheets, however I'm trying to print out just the link to the adminbar css: <link rel='stylesheet' id='admin-bar-css' ...
0
votes
1answer
113 views

Loading scripts on a single page plants the script in the footer

I'm using this code to plant a script on a spesific page, it works but inserts the script into the bottom of the page not the top - I'm at a loss to explain why! Is there a way to do this that results ...
0
votes
1answer
905 views

wp_enqueue_script jquery and jquery ui not working

I am using the following script to call my Jquery and Jquery UI as well as a custom-script.js. Currently it works to the point of being able to see the resource in the inspector and the tag's are ...
0
votes
1answer
852 views

Deregister multiple scripts using a function?

I'm trying to deregsiter multiple scripts using the following function. add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 ); function my_deregister_javascript() { if ( ...
-1
votes
1answer
87 views

wp_enqueue has a resource but doesn't generate a script tag [duplicate]

Possible Duplicate: wp_enqueue_script isn't connecting my custom js file I am really confused as to how wp_enqueue_script works. I have the following code in my header, and when I ...
1
vote
1answer
289 views

wp_enqueue_script isn't connecting my custom js file

I am using wp_enqeue_script to link to a custom.js file in my plugins folder. However I am expecting a link to show up on the page but it doesn't is there something else I am supposed to other than ...
12
votes
1answer
3k views

How to use wordpress default Password Strength Meter script

I have enqueued wordpress default password strength meter but don't know how to use it. Currently the codex page doesn't give any link to its documentation. Does any one have any links to its demo ...
2
votes
2answers
1k views

Wordpress Enqueue Script Chaos (jQuery & Foundation.js)

I've been working on building a theme for the past couple days now, and I've run into a wall. While I originally included foundation.js as an enqueued script, I couldn't remember why I had added it. ...
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"){ ...
16
votes
5answers
7k views

How do I enqueue styles/scripts on certain /wp-admin pages?

I have two simple functions that load stuff using wp_enqueue_style() and wp_enqueue_script(), something like these: function admin_custom_css() { wp_enqueue_style( 'stylesheet_name', ...
2
votes
1answer
633 views

enqueue and localize script in footer

I have a script which must run in my footer, after some variables are declared. It works if I just put the code directly in my footer file, but I think best practices dictate I should do this via ...
1
vote
2answers
254 views

Hook for writing text string after footer scripts

I'm looking to insert a string of JavaScript variables AFTER the in_footer enqueued scripts. When I write the string via the wp_footer hook, they occur before the in_footer scripts. Is there another ...
5
votes
1answer
1k views

Load js/css files only on specific admin UI pages

How do I adapt this solution to work with my plugin? (Please see the link). I enqueue my css and js script as follows: function my_plugin_init() { wp_enqueue_script('my_plugin_script', ...
1
vote
1answer
216 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
votes
1answer
1k views

Using WP Ajax and jQuery to process multiple forms on the same page?

I'm using the following to make ajax calls: wp_enqueue_script( 'my-ajax-request', TAF_PLUGIN_URL . 'js/ajaxcf.js', array( 'jquery' ) ); wp_localize_script( 'my-ajax-request', 'MyAjax', array( ...
1
vote
3answers
3k 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 ...
8
votes
1answer
5k views

How to add defer=“defer” tag in plugin javascripts?

I couldn't add defer tag in plugin javascripts. Google developer pagespeed test suggests me to add defer tag in contact form 7 javascripts. This is how contact form 7 includes javascript in header. ...
3
votes
2answers
2k views

wp_register_script not loading as expected

I am loading scripts like this: //load scripts //wp_register_script( $handle, $src, $deps, $ver, $in_footer ); add_action('wp_enqueue_scripts', 'load_scripts'); function load_scripts() { if ...
0
votes
3answers
1k views

wp_enqueue_script and wp_register_script in theme not working

I am trying to use a self written script for the jQuery library in my self-made theme, but it's not working. When I simply use script-tags, everything is alright. So it has to be something with ...
1
vote
3answers
6k views

Can't enqueue scripts in the footer?

The WordPress codex says: $in_footer (boolean) (optional) Normally scripts are placed in the section. If this parameter is true the script is placed at the bottom of the . This requires ...
3
votes
3answers
3k views

Adding jquery and thickbox to WordPress theme

I would like to add thickbox for the template which I develop to WordPress. At this time I'm trying with a clean template that have only header.php, footer.php,index.php, and functions.php. I've ...
3
votes
2answers
743 views

How to disable 3.3 Tooltips?

I find the 3.3 Tooltips annoying when I'm upgrading many live and dev sites. How do I disable them via functions.php? Unenqueue wp-includes/js/wp-pointer.js ?
7
votes
1answer
3k views

wp_enqueue_scripts, wp_register_scripts, wp_print_scripts: i'm confused

I've been reading up a bit on this subject, but the more I read - the more confused I get. Can someone explain to me in short what's the exact difference between wp_enqueue_scripts, ...
2
votes
1answer
1k views

How to use wp_enqueue_style() and wp_enqueue_script() only when needed?

My plugin uses wp_enqueue_style() and wp_enqueue_script() to load resources, but I have kept in mind not to degrade the performance for the user and only load these when the current set of posts ...
4
votes
1answer
2k views

Make jQuery library load before plugin files

I am using a few jQuery plugins such as validate.js, but they all load BEFORE the Jquery library which is loaded automatically by WordPress and my theme. I need the plugins to load after - so is ...
1
vote
1answer
263 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 ...
6
votes
2answers
5k views

Load a script just to custom post type in admin

I have created a custom post type "portfolio" with something like this : $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => ...
0
votes
1answer
664 views

Enqueue script on every page except one

I want to load my javascript and exclude 1 page, so I tried the following without success: function mypage_scripts() { if ( !is_admin() ) { wp_deregister_script('jquery'); ...
0
votes
1answer
473 views

wp_enqueue and Dependencies

Easy Question: If I enqueue a script as follows: Version A: wp_enqueue_script('my-script', plugins_url( '/path/to/file', __FILE__ ), array('jquery', 'jquery-ui-core')); Do I need to enqueue jquery ...
0
votes
1answer
122 views

Why does this fail: Disabling plugins enqueue_script() in functions.php

I'm trying to use the method presented here: Restricting a Plugin to Only Load its CSS and JS on Selected Pages? In the plugin 'syntax-highlighter-compress' I've got the following code: function ...
0
votes
2answers
402 views

wp_enqueue_script calling jQuery at different times for different browsers?

This makes no sense, but in looking at my view source across browsers, wp_localize_script() is inserting tags as expected for all browsers other than IE7,8,9. The script tag is simply not there in ...
0
votes
1answer
978 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 ...
3
votes
3answers
9k views

How to add a javascript snippet to the footer that requires jQuery

I know I can add a script file to the footer of wordpress that requires jquery using this code: <?php function my_scripts_method() { // register your script location, dependencies and version ...
1
vote
0answers
244 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+ ...
2
votes
1answer
702 views

Enqueuing Script in functions.php vs on the page

Does it matter if I enqueue a script on just the page I need it to be used? As opposed to functions.php? Or, what is the best practice? In this example I need a rotator just on the front page of my ...
5
votes
1answer
4k views

How to load Widget javascript + css files only if used?

I'd like to keep the javascript and css styles used by my widget inside their own files (and not add them to the theme). But i can't seem to get wordpress to add them when the widget is actually used ...
0
votes
1answer
1k views

How to Run a jQuery Script after a Javascript Script has Finished in WordPress

I've got javascript (a) and jQuery script (b). I need (b) to run after (a) has finished running. I need them to run sequentially. How do I do that? In wp_enqueue_script, I've made (b) dependent on ...
0
votes
1answer
1k views

TinyMCE in a div / textarea on frontend?

I have a post on my frontpage and I want to add the TinyMCE editor to it and could not make it work. I've tried these guides without any luck ...
0
votes
1answer
1k views

wp_enqueue_script() not working

I'm trying to add this social-network button: <a href="http://svejo.net/submit/?url=[your url]" data-url="[your url]" data-type="compact" id="svejo-button">Add in Svejo</a> ...
1
vote
2answers
532 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 ...
0
votes
3answers
1k views

wp_enqueue doesn't work

Some of you might know that I've been really struggling with trying to enqueue Javascript to my Wordpress theme and I just can't get it to work. I need to get this done somehow. I will keep this ...
0
votes
1answer
73 views

should i be checking for jquery before enqueing it in a plugin

At the start of a typical plugin which uses jquery I have something like the following wp_deregister_script('jquery'); wp_register_script('jquery', ...
1
vote
2answers
86 views

Same Conditionals Not Working on Two Different Hooks

Everyone! I am new to WP and trying to build a plugin. I have the following codes working properly: add_filter('the_content', 'say_hello'); function say_hello($content){ if(is_single() || ...
3
votes
2answers
616 views

jQuery in header or footer

From my reading it seems there is a good case for loading scripts like jquery and dependencies into the footer as a preference if possible; however 2 things confuse me which. Firstly the default for ...