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

0
votes
1answer
13 views

Enqueue script on specific WooCommerce template

I would like to enqueue a lightbox script on the WooCommerce page content-single-product.php. I have tried the following via functions.php: if(is_page_template( 'page-gallery.php' ) || ...
0
votes
1answer
37 views

html2canvas - It works in JSFiddle, but not in Wordpress [on hold]

I am trying to get this code from JSFiddle to work in my WP install (http://jsfiddle.net/Sq7hg/2/). I am having no luck. I am a novice JS user, but relatively experienced with WP. Here's what I've ...
0
votes
0answers
16 views

Enqueue a <script> block into <head>

I'm building a plugin that uses a shortcode to display a map and list of locations. Part of displaying that list of locations requires a handlebars.js template. That template exists as a script block ...
0
votes
1answer
17 views

Notice: wp_enqueue_script was called incorrectly

This is an error I'm receiving when my plugin is activated: Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, ...
0
votes
0answers
19 views

How to have enqueued JS listen for content change without page reload?

I've successfully registered and enqueued a js function OnLoad() { /* Do some removing and integration with the site on the output of an early stage plugin */ } if (window.addEventListener) { ...
0
votes
2answers
28 views

Why does javascript works only if logged in?

I'm trying to implement a simple script: jQuery(document).ready(function($){ $(window).scroll(function(){ if($(window).scrollTop() >= $('#masthead').outerHeight()) { ...
0
votes
0answers
12 views

get_template_directory_uri not dependent on WP_HOME in wp-config.php?

For testing on mobile devices in my local network, I've set up xip.io according to this blogpost I can access the site, but even though I added the following to my wp-config.php define('WP_HOME', ...
0
votes
1answer
26 views

Why does deregistering jQuery cause other scripts not to load?

I've inherited a site using the following in functions.php: if ( ! function_exists( 'foundation_assets' ) ) : function foundation_assets() { if (!is_admin()) { ...
0
votes
0answers
15 views

Initializing scripts in wordpress

I'm trying to initialize a script in wordpress. So far I've added the following to my theme: function theme_name_scripts() { wp_enqueue_script( 'stellar.js', ...
1
vote
1answer
17 views

Declaring script dependencies between scripts enqueued with different action hooks

Consider this scenario: I enqueued some scripts in my custom theme. Then I set off to building a plugin that I want to be used only with that one theme. I want to enqueue other scripts in my plugin ...
0
votes
1answer
22 views

Enqueuing scripts and styles in custom plugins

I have a couple of questions regarding enqueuing scripts and styles in custom plugin code. I've recently come across plugin code where scripts were enqueued hooing into the template_redirect action ...
0
votes
0answers
30 views

Make jQuery library load before plugin files in child theme

I'm setting up a site with child theme. I have installed several plugins. But few plugin files (fancybox, jQuery UI files) are loading before the jQuery library. So I am getting this error: undefined ...
0
votes
1answer
56 views

How to create a child theme with multiple css files.

Noob at wordpress development. Trying to create a child theme for a client. But the problem is that there are many css files and not one as per many tut's available, in my senario there are multiple ...
0
votes
1answer
164 views

Move all the JS files to the bottom|footer, the right way

In order to speedup my site load and prevent scripts from render the page I'm trying to move all the possible scripts (meaning JS files) from head to footer. After read and do some research I made ...
0
votes
2answers
41 views

debugging js scripts

I am having problems enqueuing javascript. When I use the script tag in the head section of my site, everything works just fine. If I take the scripts out and use enqueue, the site breaks but I don't ...
-1
votes
1answer
46 views

Enqueue scripts in the footer

I'm trying to modify a plugin for enqueue scripts in the footer, because my jQuery link is in the footer. The plugin: add_action('wp_enqueue_scripts', 'fjgwpp_addCSSandJS'); function ...
0
votes
0answers
17 views

WordPress manually load TinyMCE scripts

How can I manually load the scripts that TinyMCE requires to run on the front end of the site? I'm pulling wp_editor through AJAX, so I know I'll need to run actions in order to get the proper scripts ...
0
votes
0answers
25 views

Enqueue script in ajax shortcode call

I load a template part via ajax which contains a shortcode, which needs a javascript file to draw something. How do you enqueue it? Should I echo <script></script>? But what if it's ...
0
votes
1answer
81 views

Theme now uses require.js and enqueue script no longer works

I created a small custom script that fixes a sidebar at different point depending on if there is a banner. I used enqueue script in my child functions file and then a custom.js file with my ...
0
votes
0answers
23 views

enqueue scripts, add_action not running at all

Here is my code. I only got the '000' and the '444' echo. This is a template php file under one of my theme folder.
1
vote
0answers
18 views

How to enqueue admin content outside admincp

How do I enqueue admin javascript/css/header outside admincp, and specifically outside Wordpress. I checked one of the admin pages, and it contains this line: require_once( ABSPATH . ...
0
votes
1answer
180 views

Proper enqueue for child theme functions.php

I didn't set up a child theme to start off with, so now I'm trying to do that. I do have the child theme active. I read over this POST and still cannot get my child theme style.css to hook before ...
1
vote
2answers
240 views

tinymce is not defined when not using wp_editor

I am using jQuery tinyMCE to populate dynamically generated text areas with tiny MCE editors. When I use the WordPress wp_editor function before I call the jQuery version, I have no issues. If I do ...
0
votes
1answer
32 views

Enqueueing TinyMCE

I have decided to pull duplicated javascript from multiple custom post type files into one 'admin.min.js' file for use in all admin pages. So far I have got the script to load. This is in my ...
0
votes
0answers
24 views

custom script not loading at admin pages

I want to load a custom script on the admin pages. Seems simple right. Still, for some reason the script is not loading. I've tried putting this in my themes functions: add_action( ...
0
votes
1answer
37 views

How to include a JS file in this theme?

This makes the Jquery script work in a plugin: wp_enqueue_script('metabox_js', plugins_url('add_meta_box/js/metabox.js',dirname(__FILE__) ), array('jquery')); I have been trying for ages, & this ...
0
votes
0answers
15 views

Most optimal way of starting fresh, without using other theme or dropping old files?

I have an unusual situation: A website with very trashed styles.css (thousands of lines of trashy code), around 70+ custom templates, tons of js libraries loaded. First reaction was, lets start fresh ...
0
votes
1answer
95 views

wp_enqueue_script was called incorrectly… i want to work with debug on

i know that this error is just a notice: notice: wp_enqueue_script was called incorrectly. scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, ...
0
votes
3answers
68 views

Enqueue core jQuery in the footer?

I have this in my functions.php file and I can't get jQuery to load in the footer. The includes file loads in the footer fine, though. What else do I need to do? function starter_scripts() { ...
0
votes
2answers
166 views

How do I get jQuery to Load before Bootstrap?

I am building a Bootstrap / WordPress site and I am having an issue with bootstrap.min.js loading before jquery, which results in issues like the navigation not working correctly. Here is how I have ...
0
votes
4answers
97 views

Add js into a theme [closed]

I am trying to create new WordPress theme from scratch. I have working html, css and js files. To add JS into wordpress theme I used: function my_scripts_styles() { wp_enqueue_script( 'easing', ...
0
votes
1answer
78 views

wp_enqueue_script() not working at all

I'm trying to enqueue JavaScript files using wp_enqueue_script(), but it isn't working at all. Here is my code: function load_css_js() { wp_enqueue_style('gdgt-base', get_template_directory_uri() ...
1
vote
1answer
52 views

How to enqueu php files with custom variable & conditionals?

Hi I have taken over a website with half-customized theme. It was an outdated theme with bunch of scripts and formatting. Currently I encountered a small issue when enqueue stylesheets in ...
0
votes
0answers
17 views

How can I properly enqueue tags <link> in WordPress to use with Web Components?

The Chrome browser supports Web Components and I would like to add a number of them in WordpPress pages, but using the queuing mechanism as in the case of the functions wp_enqueue_script and ...
0
votes
1answer
53 views

Bootstrap sticky menu in WordPress

I have a menu which I have assigned the affix class using the JS and the data-spy methods but it doesn't work, there are no JS errors in my console (firefox or chrome) and the js and css of BS are at ...
0
votes
1answer
52 views

Understanding wp_enqueue_style

I am trying to understand how wordpress works, but I am having issue understanding how wp_enqueue_style(), wp_enqueue_script() works in relation to page output. From my understanding, these functions ...
0
votes
0answers
19 views

Enqueue more than 2 scripts from cdn with a callback

this subject has been covered here and it works but my questions is how to do this for more urls? for example i need to load bootsrap js / css, font awesome, animated.css from external cdn but with ...
1
vote
1answer
56 views

plugins_url() incorrectly returning wp-include directory

I doubt there's a bug with plugins_url() but this is some odd behaviour I'm seeing. I have the following in an activated plugin function include_masonry() { wp_enqueue_script( 'masonry', ...
0
votes
1answer
68 views

custom template - override plugin template in child theme - issue with scripts

I'm using a custom template for the single-listing.php from WP Listings. I've used my own theme (Canvas by woothemes) single post template, and included the wp-listings code. ...
0
votes
1answer
33 views

jQuery + more won't load in header

We moved jQuery to the footer using the following code: function jquery_enque_fix() { if( !is_admin() ) { // Enqueue so we can grab the built-in version wp_enqueue_script( 'jquery' ); ...
2
votes
2answers
78 views

Benefits to enqueuing site scripts/stylesheets?

I'm aware of a similar question here: What are the benefits of using wp_enqueue_script? - However, what differs is I'm talking about a site with a pre concatenated/minified stylesheet and site ...
0
votes
2answers
77 views

Dequeuing scripts for all pages but the home page

I'm trying to dequeue some scripts from a plugin that I only need for the home page. For the home page, I'm using a file called front-page.php with this on top to make it a home template: <?php /* ...
1
vote
0answers
42 views

Override do_item() Function to Add Extra Attribute to Scripts

The WordPress file that do_item() is in can be found here: class.wp-scripts.php Line 142 Line 144 $this->print_html .= "<script type='text/javascript' src='$src'></script>\n"; ...
0
votes
1answer
44 views

Using wp_enqueue_script in a wordpress plugin

This is my current code: <script src="http://unibet-affiliate.enetscores.com/xjs/hour/theme/affiliate/361/client"></script> <script> ...
0
votes
0answers
36 views

How add style in wp after main theme style.css

I try add style via plugin which should overwrite main theme style.css I use this code but it is not help me. function css() { wp_enqueue_style( 'css', plugins_url( '/css/style.css', __FILE__ ...
6
votes
1answer
244 views

Loading a script with a dependency, is unloading another script's dependency

First, I'm aware that my question is happening in the context of my work with the WooCommerce plugin, which would normally make it off-topic. However, I think my question relates to wp_enqueue_script, ...
0
votes
2answers
41 views

Adding Dropbox dropin js using wp_enqueue_script

I want to add a new Dropbox Drop In Chooser button to my site. To include the code in a simple page you use <script type = "text/javascript" src = ...
1
vote
1answer
41 views

Get info (url) from already enqueued styles

I am building a theme and using Easy google fonts WordPress Plugin. I created several typography controls within Theme Customizer for Post content,Post header, Author page content, Single Post ...
0
votes
1answer
93 views

Calling wp_localize_script in a different function

I am trying to localize a variable in a javascript below.. The scenario is that I want to dynamically get the post_id and localize it in the jquery I have enqueued through wp_enqueue_scripts. Here's ...
0
votes
2answers
73 views

Problem enqueuing scripts on not single posts

I have this code to enqueue a script file when the page is not single.php (neither admin page): //functions.php /********************** Add JS file **************************/ function ...