The wp-enqueue-script tag has no wiki summary.
0
votes
1answer
331 views
if custom posts type exists and there are posts load script
I have registered a custom post type 'featured_post'. I am looking for a way to test if the blog home page has any 'featured_post' posts on it and if it has load a javascript file.
The ...
0
votes
1answer
318 views
wp_enqueue_scripts in a plugin's class
I'm trying to enqueue jQuery UI in a plugin under a class method. I have this so far:
class AV_Slider {
function slider_load_js(){
wp_register_script('jquery-ui-core', ...
0
votes
1answer
171 views
Enqueueing Scripts/Styles mid-page
Since WP 3.3, the codex has been updated for both wp_enqueue_script and wp_enqueue_style that you can now enqueue both mid-page (within the HTML body).
I see this as an advantage because:
It's ...
0
votes
1answer
58 views
Wordpress Plugin Authoring question about jquery and css
When I'm writing a plugin, do I assume that jquery is included, or should I always wp_enqueue_script it and let wordpress figure it out?
Also, what's the best practice for getting an image path ...
0
votes
1answer
148 views
wp_enqueue_script does not recognize my js file?
my wp_enqueue_script does not seem to work, i can't understand why :
i have a child theme of twenty ten,
i wrote this in my functions.php file (in my theme) :
<?php
function my_scripts_method() ...
0
votes
1answer
122 views
Page not found when trying to link to files in child theme directory
I'm trying to create a child theme based on Toolbox 1.4 by Automattic.
I have my scripts file saved as child_theme/js/scripts.js on my server and I enqueue it by using
wp_enqueue_script( 'scripts', ...
0
votes
1answer
125 views
Loading Images from Javascript on the Front End
I'm getting some 404 errors on image paths in this plugin I'm building.
I'm trying to build a plugin that has some Javascript and images (like a close icon and a progress bar) that I want to load on ...
0
votes
2answers
314 views
Is there a way to set the order of wp_footer hooked functions?
I was wondering if we can set the order of a function hooked to wp_footer(), I created a function that echos:
<script> ajsfunction(); </script>
and I also enqueued the js file of this ...
0
votes
2answers
253 views
thickbox never gets called (weird behavior)
I have the exact same files (except for wp-config) running on a local server and a test server, and in my functions.php I have this:
function len_scripts() {
if (!is_admin()):
...
0
votes
1answer
629 views
wp_enqueue_script jquery and jquery ui not working
I am using the following script to call my Jquery and Jquery UI as well as a custom-script.js. Currently it works to the point of being able to see the resource in the inspector and the tag's are ...
0
votes
1answer
456 views
Enqueue script on every page except one
I want to load my javascript and exclude 1 page, so I tried the following without success:
function mypage_scripts()
{
if ( !is_admin() )
{
wp_deregister_script('jquery');
...
0
votes
2answers
385 views
wp_enqueue_script calling jQuery at different times for different browsers?
This makes no sense, but in looking at my view source across browsers, wp_localize_script() is inserting tags as expected for all browsers other than IE7,8,9. The script tag is simply not there in ...
0
votes
1answer
736 views
registering new jQuery after wp_deregister_script() not working
I have the following in my functions.php and it doesn't seem to load jQuery. If I remove the wp_deregister_script() line it appears to load the wordpress included jQuery and not the one I have ...
0
votes
3answers
3k views
How to add a javascript snippet to the footer that requires jQuery
I know I can add a script file to the footer of wordpress that requires jquery using this code:
<?php
function my_scripts_method() {
// register your script location, dependencies and version
...
0
votes
1answer
742 views
wp_enqueue_script() not working
I'm trying to add this social-network button:
<a href="http://svejo.net/submit/?url=[your url]"
data-url="[your url]"
data-type="compact"
id="svejo-button">Add in Svejo</a>
...
0
votes
1answer
574 views
What to include to use jQuery UI Auto Complete
I was looking at the scripts included with WP and dont see what I can include to use jQuery UI Auto Complete. What do I use? I tried including the whole jQuery UI from Google CDN and auto complete ...
0
votes
1answer
617 views
Enqueue Style for a page/pages only
it is causing problem because i did not do it before. I am trying to enqueue style or may be scripts depending on page. But it not working. Here is the code:
add_action('init', 'my_enqueue_styles');
...
0
votes
1answer
865 views
Calling multiple scripts using wp_enqueue_script
I'm trying to call multiple JQuery scripts using wp_enqueue_script. The call to JQuery works perfectly but the second call to cufon doesn't. I'm not a php or javascript expert - could anyone lend a ...
0
votes
1answer
336 views
Load scripts only for selected template
Is there a built in function to load scripts only for particular template?
At them moment I am doing like so:
if (is_page('portfolio') || is_page('gallery')){
wp_register_script('jScrollpane', ...
0
votes
1answer
12 views
Javascript on Registration Page
I've been trying to figure out how to implement javascript on my registration page with no luck. I've read the documentation on wordpress about properly including js, have searched for relevant ...
0
votes
0answers
14 views
wp_enqueue_script Best Practice [duplicate]
I have this script:
function my_scripts() {
wp_enqueue_script('commonfunctions', child_template_directory . '/script/commonfunctions.js', array('jquery', 'jquery-ui-draggable'), '1.0', true);
if( ...
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
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
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
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="" ...
0
votes
0answers
9 views
Strange error when using enqueue jquery scripts in my functions.php [duplicate]
I like to use my own jquery version, and the only way to stop other plugins or wordpress loading in another version of jquery, I use this function below at the top of my functions.php
// JQUERY 1.9.0
...
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
123 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
39 views
Possible to enqueue scripts and CSS to Multisite Network dashboard?
Is it possible to enqueue scripts and css only to the Network Admin Dashboard?
To edit the network admin menu, you have this hook: network_admin_menu, so I also tried network_admin_enqueue_scripts, ...
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
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 ...
0
votes
0answers
178 views
Why was wp_enqueue_script was called incorrectly? [closed]
I receive the error:
wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks.
But my code ...
0
votes
0answers
13 views
Am i right to assume that i can't conditionally load a javascript file (or not) based on the used shortcodes and values? [duplicate]
Am i right to assume that i can't conditionally load a javascript file (or not) based on the used shortcodes and values?
like in human language
if shortcode exists in the current post and value is ...
0
votes
1answer
71 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 ...
0
votes
1answer
146 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. ...
0
votes
0answers
54 views
enqueing multiple javascript files [closed]
I am trying to enque multiple javascript files I am using the following code, but only the menu.js and jquery are loading not the jquery.fittext.js
function my_scripts_method() {
...
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
0answers
134 views
Datepicker Error on pages without Datepicker [closed]
Wordpress is giving me an odd console error from a datepicker script I enqueue-ed. I read over the other datepicker questions, but they didn't solve this because the datepicker is actually working. I ...
0
votes
0answers
72 views
Child-theme, deactivate function from parent [duplicate]
Possible Duplicate:
How do I dequeue a parent theme css file?
I'm working on a child-theme from Starkers.
However, I can not disable wp_enqueue_script(), because I do not want to use the ...
0
votes
0answers
60 views
WP_register_script() - odd behavior or bug [closed]
I've got WordPress Theme and WordPress Plugin. Both use colorpicker.js file. Theme has this in functions.php (for admin only):
wp_register_script('jquery_colorpicker_script', ...
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
0answers
56 views
wp_enqueue_scripts Script dependency Catch 22? [closed]
I have a function in my functions.php that calls my custom tracking JavaScript file. It relies on Piwik's JavaScript to be loaded beforehand or else I get this error:
Uncaught ReferenceError: ...
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 ...
0
votes
2answers
418 views
include jquery plugin file not working
My code for include js as follows:
function you_fancy_js(){
wp_register_script( 'custom-script', plugins_url( '/js/jquery.js', __FILE__ ), array( 'jquery', 'jquery-ui-1.8.18.custom.min', ...