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
1answer
26 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
25 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
61 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
470 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
1k 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
83 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
95 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
33 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
44 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
190 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
25 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
21 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
684 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
885 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
44 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
33 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
51 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
18 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
227 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
335 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
510 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
145 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
564 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
57 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
27 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
94 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
69 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
27 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
95 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
128 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
64 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
93 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
128 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
62 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
52 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
52 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
291 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
58 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
56 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
130 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
117 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 ...
0
votes
1answer
74 views

Loop through arguments of a function

When I'm trying to create a loop for a object oriented approach (I think) php prompts me with 2 errors. I think it has to do something that a array ($args) can't be used on on a place where I should ...
6
votes
4answers
1k views

Is there a JavaScript API? How to access public and private data in JS?

According to this post there is no built-in JavaScript API for Wordpress. Therefore developers who want to build on AJAX seem to come up all with their own solution which doesn't seem right to me. ...
0
votes
3answers
499 views

Don't load scripts if on mobile/tablet

Would like to ask the question is it possible to stop the laoding of some scripts when viewed on a mobile/tablet device ? In the theme functions file you have wp_enqueue_script(...). How would you go ...
5
votes
2answers
1k views

Enqueue Scripts / Styles when shortcode is present

What is the idea way to register/enqueue scripts and/or styles for use in plugins? I recently made a plugin simple plugin to add the user avatar/gravatar with a shortcode. I have different style ...
0
votes
3answers
86 views

Why is my css and js not enqueued until footer?

add_action( 'wp_enqueue_scripts', function ( ) { global $post,$pageparent; if(in_array($pageparent, array($post->ID,$post->post_parent))){ wp_enqueue_style( 'products_pages', ...
0
votes
1answer
61 views

Script work on non logged in user but not work for logged in user?

I am currently working with jquery and wordpress plugin. jQuery(document).ready(function($) { $('.btn').click(function(){ alert("hello world"); }); }); This code working very well ...
1
vote
1answer
325 views

Using multiple versions of jQuery while still calling it like WP likes

I have two JS plugins inside my plugin. One uses jQuery 1.7.1 and the other 1.9.1. I need to have each of them use different version. This is how things are at the moment: Plugin php file: ...
1
vote
3answers
1k views

Can I add styles to footer with $wp_styles->add_data?

I'm working on a script to easily move js and css scripts to the footer using the add_data function in $wp_scripts and $wp_styles. I know for scripts that if the group is greater than 0 the script ...
4
votes
3answers
363 views

Combine enqueue js without affecting dependencies

I want to combine little javascript files while keeping other script's dependencies for them. Is there any way? Details: New version of BuddyPress enqueue 6-7 little javascripts: // Legacy ...