The wp-enqueue-script tag has no wiki summary.
2
votes
2answers
415 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
2answers
50 views
Enqueue scripts inside a class in a plugin
I have a plugin like this:
<?php
/*
Plugin Name: MyPlugin
*/
class MyPlugin
{
public function __construct()
{
add_action('wp_enqueue_scripts', array($this, 'enqueueAssets'));
}
...
0
votes
2answers
37 views
wp_enqueue_scripts hangs
In the following snippet, when I add the wp_enqueue_scripts call, the page freezes.
What am I doing wrong?
function my_enqueue_stuff() {
if ( is_front_page() ) {
wp_enqueue_style('style', ...
0
votes
2answers
35 views
Including Javascript options
For a Wordpress Theme I know javascript files (ending in .js) must be included using wp_enqueue_script in functions.php but how do I include additional javascript code, for example say I need to add ...
1
vote
1answer
213 views
Check if page/post has any anchors that link to an image jpg/gif/png
What I'm aiming to do is add fancybox to a site I'm developing, but I only want to enqueue the JS/CSS etc if the page/post needs it.
My thoughts are that I would need to check all the anchor tags on ...
0
votes
1answer
17 views
Child Theme - what is the scope of overwriting files?
I noticed that creating twentythirteen-child/archive.php overwrites twentythirteen/archive.php but creating twentythirteen-child/shortcodes/drop-cap/drop-cap.php does not overwrite ...
0
votes
1answer
109 views
loading javascript CDN with local fallback (not jQuery)
I'm trying to modify this to register and enqueue a jQuery plugin from a CDN with local fallback.
However, when the URL fails (or if I give it a fake url) Firebug receives 2 aborted calls to the URL ...
0
votes
1answer
122 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
1answer
92 views
force jQuery to load in the head
I've written a plugin which uses wp_enqueue_script("jquery"); to load jQuery. I need to load jQuery in the head and not at the bottom of the body. However, I think that this command is overwritten by ...
0
votes
1answer
106 views
Move jQuery to the bottom of the page whilst keeping the WordPress jQuery
I wish to move jQuery to the bottom of the page on my theme, to speed up loading times.
Previously I was doing this by replacing it with Google's CDN version but I have been told that is a bad thing ...
0
votes
1answer
129 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
113 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 ...
0
votes
1answer
58 views
admin_print_styles incuding $_SERVER['DOCUMENT_ROOT']
All the Javascript isn't working in the admin area on my production server.
Locally it works fine. I have narrowed it down to /wp-admin/wp-header.php line 72-78
do_action('admin_print_styles');
...
0
votes
1answer
124 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 ...
-1
votes
1answer
808 views
Using WP Ajax and jQuery to process multiple forms on the same page?
I'm using the following to make ajax calls:
wp_enqueue_script( 'my-ajax-request', TAF_PLUGIN_URL . 'js/ajaxcf.js', array( 'jquery' ) );
wp_localize_script( 'my-ajax-request', 'MyAjax', array( ...
2
votes
0answers
84 views
Continue javascript execution when errors occurs
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 ...
2
votes
0answers
79 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
0answers
28 views
jQuery does not enqueue for my purpose… (before an inline script in the footer)
Following How to add a javascript snippet to the footer that requires jQuery
I am trying to load jQuery before my script does stuff but it's not working.
This is it working when I include jQuery ...
0
votes
0answers
31 views
How to load script-related styles automatically?
Scenario: It is common that a JS dependency is bundled with a style file to work properly (just think about your favorite slideshow jQuery plugin). AFAIK, in this situation, the script and style have ...
0
votes
0answers
112 views
How to add vertical navigation from Foundation 3 to a Foundation 4 based theme?
I am trying to add the vertical nav bar from Foundation 3 to a theme using Foundation 4. As an experiment I created a plain html file with Foundation 4's js and css and added the js and css from ...
0
votes
0answers
32 views
Is it possible to enqueue the Youtube API script or does it have to be inline?
The code below is the main part of a function in my functions.php which returns a div and script which ultimately output a youtube API iframe to the template where the code had been called from. At ...
0
votes
0answers
50 views
wp_register_script stops wp_enqueue_style working
Ambiguous title, yes. Sorry.
I am using the roots framework to register scripts and stylesheets.
When I include the wp_enqueue_script('main_js'); my style sheets come out as <style media="" ...
-2
votes
0answers
21 views
wp_enqueue_script doesn't work!
Hello there! I am building a wordpress theme and whenever I apply the wp_enqueue_script function into my functions.php file, everything seems to go smoothly, except when I load the page. Here is the ...