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
1answer
42 views

Registering / Enqueing Scripts Not Working

Does this look correct and would there be any reason why this isn't working? In functions.php... /** * Enqueue scripts and styles */ function dcp_custom_scripts() { wp_register_script('expand', ...
0
votes
0answers
15 views

Worth enqueue_scripts for mobile via is_mobile? [duplicate]

Is it worth loading the JS for i dunno turning on a responsive menu via the is_mobile conditional? As technically its only going to be used on a mobile device, would it be good practice or improve ...
0
votes
0answers
74 views

Remove “enqueued” script from array

Im working on optimizing a child theme for a site and the parent "has more than we need" Lots of requests being generated all adds up to performance hits. What I'm trying to accomplish is this effect ...
4
votes
4answers
441 views

Include jQuery UI as a whole

Is it possible to include jQuery UI as a whole instead of: wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-effects-core'); // a lot of other jquery ui imports.... I've searched in ...
0
votes
1answer
90 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 ...
0
votes
1answer
31 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 ...
1
vote
1answer
651 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
0answers
116 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 ...
0
votes
0answers
195 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() { ...
1
vote
1answer
96 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
89 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
69 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
199 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 ...
2
votes
2answers
854 views

Adding Custom Javascript to Skeleton Child Theme

I'm trying to register & enqueue ImageMapster in my Skeleton Child Theme on the main.php page to make an image map with hovering image effects. I added this code to the "Header Functions" section ...
0
votes
1answer
156 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
83 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
16 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?
0
votes
1answer
193 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() { ...
7
votes
1answer
4k views

When should I use wp_register_script() with wp_enqueue_script() vs just wp_enqueue_script()?

I'm having trouble understanding when you need to use wp_register_script(). Currently, I just use something like: add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) ); function enqueue() ...
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() { ...
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 ...
0
votes
0answers
457 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 ...
1
vote
1answer
1k views

'jQuery is not defined Error' appearing in load-scripts.php

I'm writing this question having already found a solution, in order to see whether other people have encountered this problem. I was having a problem on the back end of a site I am building in ...
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
121 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(){ // ...
9
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 ...
1
vote
1answer
315 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 ...
6
votes
1answer
258 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
146 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
54 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
346 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 ...
2
votes
2answers
860 views

Is it possible to enqueue a script from a widget method (of extended WP_Widget object)?

I am creating a widget plugin that a user could potentially use multiple iterations of the widget multiple times on a single widget-area / multiple widget-areas on a single page. Because of its ...
0
votes
0answers
80 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
89 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
2k 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
72 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
72 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
55 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 ...
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 ...
0
votes
1answer
50 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
69 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
335 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
142 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> ...
0
votes
2answers
343 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
182 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
101 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
133 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 ...
1
vote
1answer
118 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 ...