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
1k views

How to get a jQuery script to run on a page?

I am having a hard time figuring out how to get a jQuery script to run on a Wordpress page of mine the "correct" way. I have followed this article and implemented what the first answer says to do. ...
0
votes
1answer
66 views

conditionally load javascript & CSS for do_action() calls from plugin

I am developing a plugin and using do_action() instead of shortcodes to display plugin content on the site. The plugin will only be used by me, but I am making the plugin to separate components of ...
0
votes
1answer
132 views

Call two different function.js depending on page

I'm trying to find how I can call 2 different function.js depending of the page. When on "home", I want to load "function_2.js", and on the other pages of my website the original "function.js". I ...
1
vote
1answer
95 views

How to load library scripts in admin from plugins in noConflict wrapper?

For my plugin I need to make a meta box for some custom fields in my CPT (xyz), and to organize the fields, I need to implement tabs. And I's taught to load jQuery/JavaScripts using ...
0
votes
0answers
26 views

Backbone is breaking the media uploader

Greets, when using backbone in a plugin of mine the media uploader on the post edit page stops working properly. The uplaod button doesn't work anymore and the drag and drop functionality doesnt ...
0
votes
0answers
76 views

Exclude javascript in certain page url and all following url's after forward slash

I'm trying to exclude javascript from a couple of pages. But I want to target all the pages after the forward slash. So I want to to target: www.website.com/page-name/.. So the page-name itself, ...
0
votes
1answer
97 views

Using WP functions inside javascript

I'm trying to use PHP variables inside a javascript function. What's a proper way to use a WP function like get_current_user_id() inside a script that get's enqueued via wp_enqueue_script? Right now I ...
0
votes
2answers
571 views

wp enqueue script using scripts from cdn with a safety callback

I want to include several scripts and styles from a remote CDN... in this case bootstrap and similer files but i want to provide a safety net in the form of a callback in the case the CDN is down for ...
0
votes
1answer
43 views

Conditional Javascript based on WP Version

How would I go about creating a conditional statement in PHP to load a javascript file dependent on the active version of the WP installation? i.e. if using Wordpress 3.8 load javascript file A, if ...
0
votes
2answers
75 views

Unexpected script loading order

I'm trying to make scripts load in a certain order, and am getting unexpected results. I'm using this script: function tallulah_scripts() { wp_enqueue_script( 'header-js', ...
0
votes
0answers
477 views

How can I get the jQuery Autocomplete demo to work correctly?

I'm experimenting with jQuery Autocomplete, and I'm having trouble getting it to work. The first bit of code you see below is almost an exact copy and paste from from the demo: ...
0
votes
0answers
74 views

Enqueue script throws error in console

WP version 3.9 I am editing the customizer. I have an upload field for uploading a logo. When I try to upload I receive an error. TypeError: wp.media.model.settings.post is undefined I tracked ...
0
votes
0answers
5k views

java script error Uncaught SyntaxError: Unexpected token ILLEGAL

i had a website that was working fine on localhost without any errors but after i uploaded it on the domain the slider stoped working and i got this errors Uncaught SyntaxError: Unexpected token ...
-1
votes
1answer
34 views

Enqueue script/style with multiple GET parameters

I am trying to enqueue a style with two GET parameters, but the output is not correct. Here's what I have: wp_enqueue_style('colors-css', '/root/assets/css/colors.css?style=blue'); The problem is, ...
0
votes
2answers
60 views

Remove pretty photo style and script if not exist!

I need to dequeue or remove style and script related to "pretty_photo" from my theme but load it again only when it called or needed i have this code in my functions.php ...
3
votes
1answer
124 views

jquery script not enqueued in child theme

I need a little bit of insight here with the following problem? I've created a child theme called 'test_child' which I am trying to extend in the following way: This is the test_child/functions.php ...
3
votes
1answer
86 views

Enqueue script only if page has an oembed

I have a script that adds some styles to OEmbedded content. At the moment its running on every page. I was wondering if anyone knew how to only enqueue the script if the page has an OEmbed on it. I ...
0
votes
1answer
314 views

Hook after wp_enqueue_scripts

I want to perform action when scripts are loaded. I mean when scripts are enqueued i want to take some action. Is there a hook after_wp_enqueue_scripts?
0
votes
1answer
109 views

css3-mediaqueries-js failing with child theme

Within my parent theme functions.php, I have the following snippet: // Add mediaqueries-js function footer_scripts(){ echo '<!--[if lt IE 9]><script ...
1
vote
1answer
129 views

How to add parameter to wp_enqueue_script?

I have the situation that I need to include special scripts only in case a parameter in a macro is used. For the background, see the following: My plugin ChessTempoViewer which wraps a JavaScript ...
0
votes
2answers
181 views

How to register and enqueue JavaScript files without breaking plugin dependencies?

In theme development, what is the best way to register and enqueue JavaScript files to avoid problems with plugins? I want to create a theme which uses scripts like jQuery, Masonry and so on. I ...
1
vote
1answer
55 views

Wordpress Scripts Being Loaded in Footer

I've bought a theme for a Wordpress site. I noticed that the theme author has added the javascript to the footer for load time, but as I use Gravity forms, I understand that some of scripts need to ...
0
votes
1answer
60 views

jQuery AJAX add json2 dependency?

I am working on a voting system in Wordpress with jQuery and AJAX. To make this voting system work I need jQuery in my theme. So wrote the code down in my functions.php. But for some reason my script ...
0
votes
2answers
140 views

jQuery does not work

I am working on a project where I need jQuery for. I added this to my functions, and the scripts are loaded in my header if I watch my page source, but jQuery doesn't work. What am I doing wrong? ...
1
vote
2answers
52 views

When using wp_enqueue_script(); in a theme why don't we use add_action?

When using wp_enqueue_script in a plugin, I have always been told to use an add_action : function add_my_css_and_my_js_files(){ wp_enqueue_script('jquery-validate-min', ...
1
vote
0answers
60 views

How to modify default controls in Wordpress theme customizer

I'm trying modify the default control in the wordpress theme customizer specifically the action for the close button. By default clicking it will make you go back to the themes page, but I want it to ...
0
votes
1answer
78 views

Incorrect filenames in load-scripts.php parameters

I'm attempting to load the media upload js file in a widget. The code works on my development machine and on the staging site but not on the live server. The error I get is that wp.media is undefined. ...
0
votes
1answer
32 views

Wp_deregister_script() doesn't work

Somewhere in the parent theme for which I'm creating a child theme, the following line is executed: wp_enqueue_script('quovolver', get_template_directory_uri() . ...
0
votes
2answers
47 views

add jquery file if a certain page is included

I was wondering if anyone could help my by explaining if it is possible to enqueue a javascript file only if for example homepage.php is included. what i have tried to do inside homepage.php: class ...
1
vote
1answer
63 views

Enqueue Wordpress jQuery after it's been deregistered by a plugin

I'm looking after a Wordpress install that makes use of a plugin that deregisters jQuery and replaces it with it's own ancient version. I'm aware of why loading your own jQuery is irresponsible and ...
0
votes
2answers
377 views

wp_enqueue_scripts hook is not being called

I added the following code to my functions.php: if(!function_exists('bi_frontend_scripts')) { function bi_frontend_scripts() { wp_enqueue_script('jquery'); // I originally wanted ...
0
votes
2answers
551 views

enqueue_scripts() in child theme doesn't work

I'm trying to enqueue my "scripts.js" located at the root folder of my child theme. I don't understand why the following code (located in "functions.php") doesn't work: function enqueue_scripts() { ...
0
votes
1answer
388 views

How do I enqueue a js file in functions.php for a if lt IE 9 statement? [duplicate]

I'm coding a theme that uses the Twitter Bootstrap 3 files and in the header I want to include: <!--[if lt IE 9]> <script src="<?php echo get_stylesheet_directory_uri(); ...
0
votes
2answers
493 views

Enqueue script inside IE conditional comments

I'm trying to include selectivizr.js inside conditional comments. What am I doing wrong here? <!DOCTYPE html> <html class="no-js" <?php language_attributes(); ?>> <head> ...
0
votes
1answer
43 views

jQuery does not appear to be enqueued on static homepage

I have been searching why, but I am clueless, I cannot figure out what is happening... jQuery does not appear to be enqueued on static homepage (I am not used to work with static homepages). On ...
0
votes
2answers
74 views

WP Plugin Running before jQuery

I'm having problems with jQuery and a plugin, the console error says jQuery is not defined. What I don't understand is it only fails when I load it to the production server, on my local dev ...
0
votes
1answer
776 views

'Bones' theme: Load stock scripts in footer instead of header?

I'm using the 'Bones' theme in my latest WordPress site, and when I run the site through Google PageSpeed, I receive the following error: Eliminate render-blocking JavaScript and CSS in ...
0
votes
0answers
58 views

jquery-ui-autocomplete not loaded

I am using Advanced Custom Fields for a registration form on Classipress and I have indicated that the Business Name, First Name, Last Name and Type of owner are required fields. However, when I ...
0
votes
2answers
188 views

When does WordPress automatically enqueue jQuery?

I understood that WordPress ALWAYS enqueues jQuery on all themes, thus it's reduntant to enqueue another jQuery with the same version. However, while developing a theme, for testing purposes I moved ...
0
votes
1answer
111 views

Enqueueing a code block from an options framework

I'm currently working with the Redux Framework to allow users of my theme to add additional CSS and JS code to their theme's header and footer, respectively. Redux stores this code in a global ...
0
votes
1answer
694 views

WOW.js Script Tag Initialization Header/Footer

hope things are going well. I'm attempting to use WOW.js http://mynameismatthieu.com/WOW/docs.html with animate.css to add animations to my site. WOW.js requires me to initialize it by adding the ...
-3
votes
2answers
744 views

Why does wp_enqueue_script ignore my 'wp_head' hook?

I would like css_head_scripts and js_head_scripts to be appended to wp-head but Wordpress completely ignores it? Am I missing something? function css_head_scripts() { wp_enqueue_style( ...
0
votes
2answers
146 views

call my script only after loading UI library?

i want to add small effect (UI-jquery-draggable) to the navigation buttons in one of the WP slider plugins. what i did: 1 I have installed the slider plugin 2 know that UI is allredy registerd in ...
0
votes
0answers
9 views

Javascript not bring used in 3.8 [duplicate]

I'm getting an issue on http://bollywoodbang.ca/wp/, it appears that my javascript files aren't working. I called them in functions.php using wp_enqueue_script(), and in the inspector says that the ...
0
votes
3answers
271 views

Asset loading with gulp.js or Grunt

I just started using gulp.js which is a task runner like Grunt and a lot of the sites I work on are using WordPress so I was wondering if anyone has some ideas about how to use the combined scripts ...
0
votes
2answers
25 views

is there a way to get all queued scripts/styles into a template without `get_header()`?

in my main plugin page i check if a certain page is visited if so, i load a certain template. in the following way: add_filter( 'template_include', array($this, 'includeTemplate'), 99 ); public ...
0
votes
0answers
52 views

Scripts only working on home page

I am using the following example code to enqueue several scripts.. add_action( 'wp_enqueue_scripts', 'my_scripts' ); function my_scripts() { wp_enqueue_script( 'jQuery-Main', ...
0
votes
0answers
977 views

Uncaught TypeError: Object [object Object] has no method 'dialog'

I have a project in WordPress. I am trying to implement dialog box popup on click of hyperlink. On click of this link, function shownm1() is called which is placed in .js file. The function contains ...
1
vote
1answer
393 views

How do I make sure a plugin loads a script after jQuery

My client has a site running the latest version of WordPress, with Thesis. Currently, jQuery is being loaded in the footer, as the very last script to be loaded. I'm not sure what is causing jQuery ...
1
vote
1answer
145 views

Image LazyLoad plugin not loading jQuery dependancies with wp_enqueue_script in WP 3.3.1

I am attempting to install the image LazyLoad plugin with use on my Wordpress 3.3.1 blog. I have followed the basic instructions, so it is installed and activated on my development site. The ...