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
3answers
54 views

Javascript not included

I have tried to include my javascript file in the following way: function theme_scripts() { wp_enqueue_scripts( 'custom-script', get_template_directory_uri() . '/js/menu-fix.js',array('jQuery'), ...
0
votes
1answer
38 views

Custom CSS not being added by plugin

I am attempting to add custom css through my plugin. I do have wp_head() called in my header. My code is - /** * Enqueue plugin style-file */ function prefix_add_my_stylesheet() { ...
6
votes
1answer
4k views

Register and enqueue conditional (browser-specific) javascript files?

The WP.SE community has always advised the use of wp_register_script and wp_enqueue_script for adding scripts in a theme/template (and likewise, wp_register_style and wp_enqueue_style for ...
0
votes
0answers
128 views

Blueimp file uploader inside Smart Wizard page

I have looked around and can't seem to find anything that answers the question, but if I am double posting please direct me to where I should be. I am trying to use the Blueimp File Uploader inside ...
0
votes
1answer
55 views

Ajax Request with jQuery not happening

My problem is: Can't do a POST request with jQuery. Down here is the complete description: I created a link in a page (using the plugin PHP code for posts and pages): <?php $nonce = ...
0
votes
1answer
24 views

Overide enqueue in non plugable function via child theme

I am trying to override a non-plugable function using the information on this page but it seems to have no effect. Can anyone see what's wrong. My code is remove_action('wp_print_styles', ...
0
votes
0answers
88 views

How do I display the handle for all front-end enqueued scripts in plugin options page?

I use the following function in my plugin to display all the scripts handles in my plugin options page but it display only the handles of admin scripts: function my_detected_scripts() { global ...
0
votes
0answers
49 views

How to get transient cache to work with wp_enqueue_script

So I have this page that has various shortcodes on it. Each shortcode may have wp_enqueue_script to load say jQuery accordion or tabs. Now I am wanted to cache the page for better performance so I ...
2
votes
1answer
1k views

Problem using is_single() to enqueue script from functions.php

I'm having trouble only adding scripts to single post pages. I need to both include and exclude certain scripts using is_single() but it doesn't work either way I try it. I have the template tag on ...
2
votes
1answer
177 views

Dynamically Load Styles and Scripts from Theme Functions.php

I am attempting to dynamically load stylesheets and scripts based on the template name. So if I have a template named page-signup.php then it will load the corresponding stylesheet page-signup.css and ...
2
votes
2answers
126 views

Correct Method to run scripts with dependencies without enqueue?

With enqueue you would change $deps to your script or array of scripts that are needed to run first for your script to work. <?php wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); ...
0
votes
2answers
168 views

$.browser Undefined Seemingly Causing Faulty Page Display

At this site I have an error using the parent theme's jquery.PrettyPhoto.js This causes tabs not to load well nor gallery to work well it seems. The error states TypeError: $.browser is undefined ...
1
vote
2answers
305 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 ...
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 ...
1
vote
1answer
40 views

Execute only on a certain page

I"m trying to get the block of code below to load only when it's the contact page but it doesn't seem to wotk. Any ideas what the problem could be. Still pretty much new to PHP. if ...
2
votes
2answers
954 views

WordPress Script Loading/Unloading — wp_deregister_script('jquery')

I have a few questions relating to WordPress loading / unloading up javascript tools. After reading a nicely written response to a question by Pieter Goosen, that got me to do a bit of studying and a ...
1
vote
1answer
54 views

How resource intensive is wp_register_script()?

I'm trying to use the has_shortcode() function to only load certain scripts when there is a shortcode in the post's content, with this code: wp_register_script( 'shortcode-js-file' , FILE_URI, array( ...
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. ...
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
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 ...
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 ...
23
votes
7answers
9k views

Conditionally Loading JavaScript/CSS for Shortcodes

I released a plugin that creates a shortcode and requires a JavaScript file and a CSS file to load on any page that contains that shortcode. I could just make the script/style load on all pages, but ...
0
votes
1answer
378 views

wp_enqueue_scripts called twice?

I had some problem with WP recognizing a is_single condition for loading scripts called in function.php. I put a error_log(is_single()) to check what was going on. When opening a post page the log ...
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, ...
2
votes
1answer
192 views

Multisite plugin development and wp_enqueue_script

I have a plugin I'm developing. It works fine on a single site version of WordPress. It installs on a multisite version of WordPress, it appears to work on the admin pages, but when the plugin ...
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
559 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 ...
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 ...
1
vote
1answer
407 views

Trying to add script to specific admin page is not working

What I am trying to achieve is to load a .js file on an edit.php page, however the code is not working specifically for this page. I've applied the same code type of code to other CPT pages, but for ...
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
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
476 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 ...
3
votes
3answers
2k views

Is this a bad implementation of wp_enqueue_script for conditional usage?

Conditionally Including scripts whether js or css in xhtml document head...has been a generally tricky affair, especially if you want to enqueue something, based on a shortcode or custom meta field or ...
-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, ...
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
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 ...
0
votes
1answer
108 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 ...
0
votes
1answer
309 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?
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
180 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 ...
0
votes
1answer
110 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 ...
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
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? ...
0
votes
1answer
59 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 ...
5
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: ...