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
2answers
179 views

Register and load scripts

In my functions.php function load_scripts() { wp_enqueue_script( 'jquery' ); wp_register_script( 'modernizr', get_template_directory_uri() .'/js/modernizr.foundation.js' ); ...
0
votes
1answer
75 views

Enqueue ONLY Plugin Styles and Scripts

Is there a way to enqueue only plugin styles and scripts without wp_head? I have a plugin I'm working on which overrides the page template, but I still want to include all other plugins without ...
0
votes
1answer
59 views

why quotes shown in Wordpress?

I have written a function to register a script in the admin interface. function custom_admin_js() { $url = get_bloginfo('template_directory') . '/admin/admin.js'; echo '<script ...
0
votes
1answer
274 views

Register script/style: Is it possible to customize the version query string via plugin?

Expanding on the question in the title: I would like to find a way (via a plugin) to use timestamps for the JS and CSS file version query strings that are output with wp_register_style and ...
0
votes
1answer
168 views

“admin_enqueue_scripts” hook or $_GET['page']?

When adding a function to "admin_enqueue_scripts" a hook is passed to the function. It looks like this "toplevel_page_nameofyourpage". That works great, but how is it different from checking the $_GET ...
0
votes
2answers
168 views

Is the wp_enqueue method efficient?

I had a quick question regarding how you are supposed to load in scripts with Wordpress. I am developing a theme and I know that the best way to do this is to use the ...
2
votes
0answers
107 views

Continue javascript execution when errors occurs [duplicate]

I use the WP native function wp_enqueue_script() for all my JavaScripts loading both in WP front and back-end so it can handle duplicated calls to the same script and so on. One of the issues is that ...
0
votes
1answer
245 views

How to enqueue script based on post category?

I have scripts for various little tools I have made using some js and html. I want the js to load only on specific single posts in side a specific category. I have tried the following code and it does ...
3
votes
1answer
280 views

Is it safe/recommended to use wp_enqueue_script function outside the functions.php file?

I created multiple post formats, and when i use an audio post format, i want to include some additional javascript for the audio player. So, i include the content-audio.php like this: <?php ...
1
vote
1answer
1k views

How can I enqueue protocol relative external (//ajax.googleapis.com/…) scripts?

According to the Codex, wp_enqueue_script supports protocol relative, or protocol agnostic external links: "Remote assets can be specified with a protocol-agnostic URL, i.e. ...
2
votes
1answer
2k views

How do I implement the Wordpress Iris picker into my plugin on the front-end?

This question here is asking the same question as I am, but there were no adequate answers nor a selected correct answer so I am asking again hoping if I ask in a more coherent manner I might get a ...
2
votes
1answer
175 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 ...
2
votes
1answer
484 views

How do I enqueue(or delay loading of) <script> tags in individual page posts?

My customer has many pages with <script> elements including javascript. <script src="myscriptforthispageonly.js"></script> I'm trying to get all scripts to load in the footer ...
0
votes
1answer
142 views

How do I pass $in_foooter to wp_enqueue_script() without passing other params?

I have some scripts that I'm enqueueing like this: wp_enqueue_script("jquery"); wp_enqueue_script("myscript" , get_template_directory_uri()."/js/myscript.js", Array('myscript'), " "); I want to ...
0
votes
2answers
405 views

Including javascript for a shortcode

I'm creating a plugin that allows a user to use a shortcode. This shortcode depends on a bunch of javascript that needs to be present once the shortcode loads. I'm having issues trying to decide when ...
5
votes
1answer
3k 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() ...
0
votes
2answers
172 views

All of my Scripts and Enques are getting file not found

I have the following script and enque function, and the site properly renders it in the html head, however when I click the link to the css and javascript files the i get a url not found, however the ...
0
votes
1answer
564 views

wp_localize_script & wp_enqueue_script not working in front end

Here is my code snippet : wp_enqueue_script( 'ajax-script', get_stylesheet_directory_uri().'/js/myajax.js', array('jquery'), 1.0 ); wp_localize_script( 'ajax-script', 'ajax_object', array( 'ajaxurl' ...
2
votes
1answer
715 views

Protocol neutral URLS with wp_enqueue_script (SSL issues)?

How do I use wp_enqueue_script so that I get protocol neutral URLs? Here is how I'm currently using it: <?php wp_enqueue_script('name', get_bloginfo('template_directory'). '/js/name.pack.js'); ...
0
votes
1answer
175 views

Why is it wrong to use admin_print_scripts-{hook} to enqueue a script (.js) file?

According to the Codex, it should only be used for inline script tag(s) in the head. I've been using add_action('admin_print_scripts-{my-hook}' for injecting .js and ...
-1
votes
4answers
230 views

Can't get jQuery to enqueue into post edit script

In the code below, unless I hardcode a reference to the jQuery library, my jQuery bits on the page do not work. What's wrong with the enqueue method I'm trying to use? In functions.php: ...
0
votes
1answer
178 views

colorbox not loading in <head>

I can not get colorbox fully loaded. I am trying to add color box to use in my plugin admin. I do not need it for the front end. I can get the css but can not get jquery.colorbox-min.js or the ...
0
votes
2answers
129 views

If a Script has been enqueued but not registered can I still removed it?

There is a plugin that's conflicting with mine when the user loads the admin pages of my plugin, therefore I want to deregister and remove the conflicting script on these pages. Here is the code for ...
2
votes
1answer
97 views

Performance-wise, is it better to enqueue a (small) script on every page or test to see if it's needed?

I'm using the FitVids.js script to make YouTube video embeds work with a responsive layout. The script is < 3kb, but only about half of my pages actually have YouTube embeds. In terms of total ...
0
votes
1answer
167 views

Problem getting .js file to load via a plugin

This http://jsfiddle.net/ambiguous/7L4WZ/ works...it removes empty <p></p> tags and then some but I can not git it to work from my plugin. $('p').each(function() { var $this = ...
0
votes
2answers
356 views

Trying to get custom js files in my admin header

I'm trying to add a java script file to my admin header and use admin-ajax.php to use ajax in my wp-admin (still learning a lot about the process). I've created a custom folder in my ...
0
votes
1answer
227 views

Dynamic wp_enqueue_scripts?

Is it possible to call wp_enqueue_scripts dynamically? For example, I want to use in function.php my own function addThemeJS( true, 'modernizr', THEME_JS_DIR . "/plugins/modernizr.custom.js", ...
0
votes
1answer
345 views

Fatal error: allowed memory size when after using enqueue_script

I an trying to enqueue four script files and keep getting this error: Fatal error: Allowed memory size of 103809024 bytes exhausted ... wp-includes/class.wp-dependencies.php on line 175. I used ...
0
votes
1answer
192 views

plugin's script and style enqueing not working on Thesis

I've published a plugin on WP repository that allows some theming for Gravity Forms. This plugin as been tested with Twenty Ten, and Twenty Eleven. When I've tried to test it in a site that uses ...
2
votes
1answer
287 views

Add script to footer - on post editor

How do you add a script on the footer of the post editor ? I'm adding a meta box under the post editor and I need to include a javascript before the closing body tag (on the footer) How do I achieve ...
-2
votes
1answer
522 views

Orbit Slider and Events Manager Plug-in JavaScript

I have this slider(orbit slider http://foundation.zurb.com/docs/orbit.php ) and a wordpress plugin(event manager http://wp-events-plugin.com/ ) that loads all this jQuery-ui stuff( /** * Enqueing ...
2
votes
1answer
447 views

WP_enqueue_script inside shortcode?

I've got shortcode that needs to include JS library only once and only there where it's used. function shortcode_function($atts, $content = null) { $class = shortcode_atts( array('something' ...
0
votes
1answer
1k views

Custom Admin CSS styles to style media uploader?

Hopefully a simple answer to this. Using the wp custom header feature, the media upload screen shows an extra field: "set as header". I'm trying to make this text bigger as it can easily be missed. ...
0
votes
1answer
807 views

wordpress enqueue script not working

I am using a carousel to display latest jposts on my front page and I am using the following code but it's not working. function my_load_caroufredsel() { // Enqueue carouFredSel, note that we ...
0
votes
1answer
301 views

How To Include JavaScript Files Only In Single Posts?

I know that wp_enqueue_script() inserts Javascript files into the WordPress header in the appropriate place. However, I want to include my Javascript in all single posts, ignoring the WordPress home ...
1
vote
2answers
194 views

Avoiding Duplicate function names in Post Loop (WP_Footer script)

Say I created a plugin that injects content (used as a shortcode) into a post. I'm trying to push that code for each post to the bottom of the page. This works fine, however when you are on an ...
0
votes
1answer
199 views

How to use wp_enqueue_script, style when required

There are lot of unused js & stylesheets in my theme. here is wp_register function in my functions.php wp_register_script( 'moder', base_url . 'js/modtom.js', array(), false, false ); ...
1
vote
2answers
215 views

Adding scripts to admin page in my theme

In functions.php of my theme I have code to add page in admin area and append scripts to it. But scripts are not loaded. Bellow is code. Commented out add_action lines are the one I did check. // ...
0
votes
1answer
1k views

wp_enqueue_script won't load in header?

Read up on this, and I believe I'm doing everything right. Everything is getting loaded in the footer. Here is my code: function load_kenburns() { if ( !is_admin() ) { wp_register_script( 'kenburns', ...
2
votes
2answers
814 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 ...
1
vote
1answer
713 views

Which action to hook wp_enqueue_script to? wp_head or wp_enqueue_scripts? [duplicate]

Possible Duplicate: Where is the right place to register/enqueue scripts & styles According to wp_enqueue_script() documentation in Codex, it seems that one should hook ...
7
votes
1answer
5k views

How do I dequeue a parent theme css file?

My parent theme (Starkers) adds a CSS file that I'm trying to remove (I want to use @import instead so I can override styles more easily). Starkers has the following in its functions.php: add_action( ...
0
votes
1answer
2k views

Remove a script from a template file using wp_dequeue_script

I thought I had read it was possible to use wp_enqueue_script() and wp_dequeue_script() directly in individual template files. However, when I add wp_dequeue_script( 'myscript' ); to the top of ...
0
votes
1answer
91 views

How to enque js script in footer that are not in .js file?

I do have code that is js script inline together with php script is their possible way to enque it to footer without puting it on .js file To clear explanition on my question here is my example code ...
0
votes
1answer
671 views

Cannot enqueue jQuery correctly using Google CDN

The problem: I understand how to regularly enqueue jQuery UI in functions.php. My problem is that I'm using a selectmenu widget that doesn't come with WordPress by default: ...
0
votes
2answers
1k views

How to Add a Custom Script to Customize.php

I am having a rather difficult time adding a script to the 3.4 Theme Customizer (i.e., customize.php). If I want, I can deregister jquery and add it from googleapi as follows: wp_deregister_script( ...
0
votes
2answers
955 views

Setting Variable Path to Template Directory inside Script

I have HTML5 Template with 5 pages. I am converting it to a WordPress Theme. I have a contact page. This page includes 'forms.js' script to send contact form data to 'MailHandler.php' file. Inside ...
0
votes
1answer
492 views

Using jquery-1.7.2.min.js instead of the wordpress jquery

I have been trying to deregister the wordpress native jquery and use my version that i have downloaded.At first everything was working fine with the wordpress resident jquery albeit replacing $ with ...
0
votes
3answers
1k views

Loading Modernizr (or other JavaScript libraries) for use in a plugin

Download a copy of Modernizr, put it in your plugin’s directory and simply enqueue the script whenever needed. Done. The problem is that Modernizr may already be loaded by another plugin. You ...
0
votes
3answers
1k views

What can I hook into after_setup_theme?

I'm wondering what can I or should I NOT hook to after_setup_theme? I'm wondering because I have been told that I shouldn't hook wp_enqueue_style to it, but I have seen other places using it to hook ...