The wp-enqueue-script tag has no wiki summary.
0
votes
2answers
240 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
295 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
79 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
93 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
591 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
407 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
69 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
228 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 ...
11
votes
1answer
1k 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
610 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
959 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"){
...
10
votes
4answers
3k 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
389 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 ...
0
votes
2answers
133 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 ...
4
votes
1answer
488 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
111 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
768 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
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 ...
5
votes
1answer
1k 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
1k 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
772 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 ...
0
votes
3answers
2k 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
2answers
1k views
Adding jquery and thickbox to wordpress theme
I would like to add thickbox for the template which I develop to wordpres. At this time I'm trying with a clean template that have only header.php footer.php index.php and functions.php
I've included ...
3
votes
2answers
492 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 ?
5
votes
1answer
1k 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
742 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
746 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
182 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 ...
4
votes
1answer
2k 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
440 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
192 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
95 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
383 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
711 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
3answers
2k 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
187 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
391 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 ...
4
votes
1answer
2k 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
680 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
961 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
720 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
361 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
66 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
62 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
438 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 ...
0
votes
2answers
389 views
Script loaders vs wp_enqueue_script
My Wordpress theme has a lot of .js scripts running and it takes plenty of time to load them all one by one. I would love to use a script loader like HeadJS or
yepnopejs to speed things up.
But... ...
1
vote
1answer
757 views
Why is jquery-ui-core enqueueing in my footer instead of the header?
This is what I'm using to make sure that I have jquery-ui-core available:
if (!is_admin()) add_action('wp_enqueue_scripts', 'zg_load_scripts');
function zg_load_scripts(){
...
1
vote
1answer
341 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 ...
2
votes
1answer
1k views
wp_enqueue_script order - external vs inline js
I have a few scripts loading with my theme:
// loading script.js
<script type="text/javascript" src="script.js"></script>
// doing something using script.js
<script ...