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
506 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" ...
0
votes
1answer
30 views

Wordpress include scripts and style in plugin page

I am working on a Wordpress plugin where I want to include some jquery scripts and stylesheet. I found dit piece of code in an article and this should do the job, but it doesn't work for me. Can ...
0
votes
1answer
86 views

Ajax navigation and scripts loaded only on certain pages

I'm building a theme. The theme post navigation is done through jQuery Ajax. I've been several plugins to see compatibility and I have a problem with the Ajax functionallity. Some plugins such as ...
1
vote
2answers
287 views

enqueue script only if it is not already enqueue

I want to include a script in a shortcode output, so I am trying this: function my_shortcode( $atts, $content = null ) { extract(shortcode_atts(array( 'title' => '', ), ...
0
votes
0answers
152 views

JS enqueue path (localhost)

Im trying to load the flexslider.ls file in the footer of frontpage, it just loaded Jquery only, without flexsilder.js I tried through full path // Load the Theme JS function theme_js() { ...
0
votes
0answers
92 views

Clarify: Enqueueing scripts within shortcode only loads in footer?

Each time I enqueue scripts inside the shortcode handler, it ends up in the footer. It doesn't matter whether I register them first and set it to load in the header, if I enqueue inside the shortcode ...
1
vote
1answer
92 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 ...
0
votes
1answer
79 views

How do you load js and style resources from CDN with local fallback using wp_enqueue_scripts?

I had a hard time finding the correct way to do this. I want to load the CDN resources here: http://www.bootstrapcdn.com/ but use wp_enqueue_scripts and have local fallback. This is the method I am ...
2
votes
1answer
63 views

How to control the order of the combination of enqueued styles and scripts - site speed issue

We know, using wp_head() and wp_footer() all the scripts and styles are enqueued using wp_enqueue_styles and wp_enqueue_scripts hook. What we do is to enqueue our stylesheets and scripts using ...
0
votes
0answers
172 views

Plugins enqueuing jquery in head

I am trying to optimise my site for mobile and enqueued my scripts to be placed in the footer so as to eliminate render-blocking javascript in above the fold content. Unfortunately some of the plugins ...
0
votes
1answer
129 views

Can't see why my scripts aren't loading when I register and enqueue them

I'm trying to replace "hardcoded" calls in my header.php by registering and enqueueing them in functions.php. JQuery 1.8.3 loads as desired, but the other scripts don't. Here's what I'm using: ...
-3
votes
1answer
80 views

Trying to use wp_register_script/style and enqueu them from an array - getting an error [duplicate]

here is what i got so far: // my array $this->headersArray = array( array('handle' => 'buy_mobile_funcs', 'src' => 'jsFunctions', 'extention' => 'js', 'deps' => '', 'media' => ...
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
57 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() { ...
10
votes
3answers
1k views

Is it possible to use wp_localize_script to create global JS variables without a specific script handle?

Can we somehow use wp_localize_script() to create global js variables without a specific script handle which can be accessed from all the js files, even if the js scripts are not enqueued properly by ...
0
votes
0answers
379 views

wp_enqueue_script() doesn't work with AJAX

My problem is: I made an AJAX call using this code wp_enqueue_script( 'prefix-myscript-name', plugins_url( 'js/ajaxcall.js', __FILE__ ) ); I made the call and the AJAX just going fine. I used this ...
0
votes
1answer
187 views

Issues with wp_enqueue_script and jquery-ui

wp_enqueue_script('jquery-effects-shake'); ..doesn't seem to work, no matter where I put it. I've tried the following and lots of googling: function my_callback() { ...
0
votes
2answers
1k views

jQuery code not working when included in functions.php

I feel like I am definitely missing something simple here... but for the life of me, can't find what I'm missing. I am of the "bad habit" of including jQuery functions directly in the header.php file ...
0
votes
1answer
42 views

Enqueue scripts based on options

What is the best method to enqueue scripts based on options I have? Let's say I have 50 options and for each I need to enqueue a script(some of them might repeat.). Can I have any ...
1
vote
1answer
277 views

How to run a external JavaScript file on wp-admin if admin, and other if normal user?

I'm new to WordPress plugins, and I'm trying to load a external JS/jQuery file with some scripts I need. It needs to run in the wp-admin page (not just once when activated). There is a JS file for a ...
0
votes
2answers
660 views

Deregister scripts on unnecessary pages using remove_action

To all would-be close-voters: This question is not a duplicate, because I need to remove all scripts added by plugin using remove_action. In Very stubborn wp_register_script / add_action vs ...
0
votes
1answer
115 views

Very stubborn wp_register_script / add_action vs remove

I am trying to get rid of a plugin's .js file in the but it's not working. It's being called here {partial code): class awqsf{ const post_type = 'awqsf'; function __construct(){ // ...
6
votes
1answer
202 views

Register a script to be enqueued both in admin and front end

As i understand it, admin scripts are supposed to be registered and enqueued through the admin_enqueue_scripts hook and all other scripts at wp_enqueue_scripts so i have set up the following functions ...
1
vote
1answer
133 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( ...
0
votes
1answer
52 views

Enqueueing Scripts and Styles

I'm trying to enqueue my custom script and style with the block of codes, the scripts works but not the style. I don't know what I'm doing wrong. function my_scripts_method() { ...
1
vote
3answers
302 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
0answers
77 views

Change Login CSS - Include instead of echo

I'm trying to figure out how to include a stylesheet instead of echo'ing <style> tags. I'm currently using the following function: // Custom Login Styles function login_styles() { echo ...
0
votes
0answers
82 views

Why can't I load JS script in a plugin?

I have this at the bottom of my plugin file, but while I can access the plugin, I can't see any reference in the code to jquery.chained.min.js in the source: add_action( 'wp_enqueue_scripts', ...
3
votes
1answer
1k views

wp_enqueue_script : how to change loading order of scripts?

I would like to know how to list all scripts loaded on a page, ranked by order and change this order.
1
vote
1answer
69 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', ...
0
votes
0answers
69 views

Adding javascript files to WordPress and jQuery version

I've been trying to use the recommended method of adding javascript files to WordPress, after reading this http://codex.wordpress.org/Function_Reference/wp_enqueue_script but I'm having a hard time ...
0
votes
0answers
51 views

using enqueue_script in a shortcode isn't working

I'm new to wordpress and I'm trying to get this to work by following the wordpress codex but I feel like I must be missing something obvious. I have a child theme based off of a parent one, and I ...
0
votes
1answer
46 views

why the wp_register_script doesn't work for register_activation_hook

I want to register a script when my plugin is activated. So I wrote: register_activation_hook(__FILE__, 'register_script'); function register_script(){ ...
1
vote
1answer
65 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, ...
2
votes
2answers
1k views

Enqueue script in specific page

I am building a wordpress theme with a theme dashboard with options, but as I read somewhere, the enqueue script code I am using just enqueues it in the backend but it loads in every page in the ...
1
vote
0answers
305 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
125 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
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 ...
0
votes
2answers
315 views

JS plugin script loading but not working

I am trying to create a theme using curtains.js but am having a few problems. I have both registered and enqueued the script and the part that would go in the footer like so: ...
0
votes
1answer
37 views

How to know what are the style sheets are available in wordpess?

I just like to use jquery-ui Style Sheet but i don't know whether it's pre-installed in WordPress or not b'coz without knowing that i think it will create a problem. what in case it is available in ...
1
vote
1answer
152 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) ) { ...
0
votes
1answer
91 views

How to include php-generated javascript?

I've looked around and have found no great solution so far: I would like to add customized javascript from a widget using wp_enqueue_script, but Wordpress seems to be limiting scope to the javascript ...
-1
votes
1answer
130 views

jQuery issue and wp_enqueue_script

Actually i have one theme with enqueue for insert jquery code and reference for the core and also jquery iu Bus happend things that i don´t understad, actually as i tell until i need insert code for ...
4
votes
5answers
1k views

Adding Additional Attributes in Script Tag for 3rd party JS

I ran into this when attempting to integrate Dropbox's drop in chooser API to a plugin I'm writing. The API documentation instructs you to place the following script tag at the top of your file: ...
1
vote
1answer
112 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: ...
0
votes
1answer
72 views

How to enqueue scripts in right way in a plugin?

I am developing a wordpress plugin and just came out with a problem with enqueue scripts. I want to enqueue JQUERY UI (.js) and (.css) in my plugin. Is it better to enqueue it from Google CDN or ...
0
votes
1answer
58 views

JavaScript Libraries in WordPress

I understand that in order to use a JavaScript library in WordPress, such as jQuery, we have to use the following code to prevent conflicts: function my_scripts_method() { wp_enqueue_script( ...
0
votes
1answer
80 views

wp_enqueue doesn't load dependencies

I'm trying to load style.css but rest.css should be included first. I don't understand why reset.css is not included function addMyScript() { wp_register_style('style', ...
0
votes
1answer
269 views

In jquery use php variable to execute an enqueued jquery file

I am loading some jquery on a specific Wordpress admin page, the jquery loads and works fine but I need have this jquery only trigger if a php variable exists. In php I would just write a function ...
0
votes
0answers
62 views

Using array page name together with page id to deregister script

If I use this: if (is_page(array(blabla-test-page, 20726, 20720, 38881))) {wp_deregister_script( 'gdsr_script' ); } the blabla-test-page looks like it overrides different pages, even if certain ...