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

How to enqueue JavaScripts in a plugin

I am struggling a lot this time working on including a JavaScript files in plugin folder. I am trying to create a plugin by transferring widget files from themes directory. I copied the widget file, ...
0
votes
1answer
26 views

File not enqueueing

I hate to add to the multitude of "script not enqueueing" questions, but I can't seem to figure out why my "tablesorter" scripts won't enqueue. The other script (customsjs) in the same directory is ...
0
votes
1answer
24 views

WordPress Ajax problem with undefined url

I have problem with wordpress plugin - in jQuery.ajax part, the ajax_object (url: ajax_object.ajax_url) is undefined and I don't know why. I cant recieve correct code from my php plugin, but if I ...
0
votes
1answer
15 views

Enqueue script in header

I'm having issues enqueueing a script in the header. I'm working on a Wordpress site where the page content is loaded via AJAX. To do this I have to enqueue the script with the AJAX call. I do this ...
0
votes
3answers
29 views

Using wp_enqueue_script on scripts that contain PHP

I'm am working on a WooCommerce website, and have all my jQuery in the footer inside script tags. I use PHP to filter out the needed scripts for any particular page. However, I would like to use the ...
0
votes
1answer
27 views

wp_enqueue_script inside a class static function [closed]

I have searched for a solution of my problem, but without resolution. I have writed a plugin and in init hook I call wp_enqueue_script and wp_enqueue_style. wp_enqueue_style work correctly, ...
0
votes
0answers
16 views

How to implement wp_localize_script with add_menu_page

I have a class Namer and this class adds a menu page (add_menu_page) and this in turn loads CSS and javscript, but I can't seem to load the wp_localize_script to do AJAX calls & Nonce, here is my ...
0
votes
0answers
19 views

How do I get the full details of a registered/enqueued script?

I'm trying to get the details (such as src, in_footer etc) of enqueued/registered scripts. For example: add_action('init', function() { global $wp_scripts; var_dump($wp_scripts->queue); ...
1
vote
3answers
46 views

WordPress script file version numbers changing in live environment

I'm registering my javascript files for Wordpress in my functions file as so: if( !function_exists( "theme_js" ) ) { function theme_js(){ wp_register_script('wpbs-scripts', ...
2
votes
1answer
73 views

Remove specific CSS and JS from the head

I'm trying to remove some specific lines from the WP_HEAD. Now my header looks following way: <link rel='stylesheet' id='bootstrap-css' href='/themes/wp-e/css/bootstrap.css?ver=4.2.2' ...
0
votes
3answers
46 views

How to load JS and CSS only on specific Pages using is_page()?

I am building my first WP plugin, it should load some JS and CSS files only on specific pages selected through a form available in the plugin Admin area. Once selected in the form, Page Title gets ...
8
votes
3answers
150 views

Any advantage of using wp_scripts and is_IE when enqueuing scripts

I read on the WP docs, which pointed to this gist that the correct way to enqueue styles for IE is by using the $wp_styles. I'm guessing that this would be true then for scripts as well. Take these ...
0
votes
2answers
35 views

Enqueue script in plugin is not working

I can't figure out why this script wont load on site. Am I missing something? function ajax_follow_enqueue_scripts() { wp_register_script('follow', plugins_url('the-follow.js', __FILE__)); ...
0
votes
1answer
32 views

Enqueue script: link not working in page source

I am using the Front-End Editor plugin of Scribu at my website. I want to enqueue it, because I want to use it alongside my caching plugin, but that one only works when JS files are enqueued. The ...
0
votes
2answers
32 views

Enqueue scripts to footer

i know how i can print a single script with wp_dequeue_script and wp_enqueue_script to the footer: function dequeue_my_scripts() { wp_dequeue_script('dgx_donate_paypalstd_script'); } add_action( ...
1
vote
2answers
43 views

How do I load custom scripts and styles for a page?

Different pages often need different set of scripts and styles for them. I use functions.php and construction like this to load scripts and styles: function load_assets() { wp_enqueue_style( ...
0
votes
1answer
27 views

Enqueue script, taking no effect [closed]

I've added my custom_script.js to my child theme by making a /js folder, and I added it within my functions.php like this: /*** Make Header Shrink on Page Scroll**/ add_action( 'wp_enqueue_scripts', ...
0
votes
1answer
35 views

JavaScript and Google PageSpeed + wp_enqueue_script

The best theme in WordPress theme development requires a standard protocol of enqueuing scripts through wp_enqueue_script, but this doesn't solve the problem and Google PageSpeed suffers. I found a ...
4
votes
3answers
2k views

What does wp-embed.min.js do in WordPress 4.4?

Question What does the wp-embed.min.js file do? I noticed it is added to the end of my blog page footer. How can I get rid of it? Effort After some googling and I found Embeds on the Codex. Why ...
1
vote
2answers
37 views

wp enqueue, how to prevent duplication when same script is registered with different handles

I read that wp enqueue prevents duplicate script to be loaded. But, what happens when same script ( say bootstrap.js) is loaded by 2 different plugins with 2 different handles using wp enqueue ?
0
votes
0answers
17 views

add inline javascript like wp_add_inline_style

How can I add an inline js right after my selected enqueued file? like we can do with inline_style I want to add noconflict to an external jquery file (through cdn)
0
votes
0answers
30 views

Admin - Dequeue unnecessary scripts/styles

Currently, I'm working on a plugin where I use custom post type. In each post type edit page I've got meta data fields to set advanced functionalities. However, because the interface needs to take ...
0
votes
0answers
50 views

Javascript file doesn't load

I have a mysterious problem - the script file isn't loaded. The same code works on a test server. But when we uploaded it to the live server and looking at the browser console at "sources", it didn't ...
0
votes
2answers
32 views

Include script files for admin submenu page

I created a sub page to "users.php" where I can add a user in a customized way. I used a lot of the code from "user-new.php". However, user-new.php seems to rely on some javascript file to display the ...
0
votes
1answer
35 views

Enqueue script not working

This is my code to enqueue scripts. The later one with title yourscript2 is working, but the first one with title upload is not working: add_action( 'wp_enqueue_scripts', 'add_my_script' ); function ...
0
votes
0answers
83 views

Gravity Forms loading jquery

I placed the following script in my functions file to deregister Wordpress jquery and use the Google CDN. // use the Google hosted jquery library if (!function_exists('modify_jquery')) { function ...
0
votes
2answers
61 views

Enqueue js script to footer

I need to run wp_enqueue on javascript files after the DOM has been populated because I need to target a div. EDIT I am trying to add the following three scripts: wp_enqueue_script('react_js', ...
1
vote
2answers
76 views

Searching multiple tags and adding jQuery dependant script onto page template?

I have this simple javascript file for checking boxes in a tree view menu: treeview.js $(".acidjs-css3-treeview").delegate("label input:checkbox", "change", function() { var checkbox = ...
1
vote
3answers
61 views

Why isn't jQuery 2.1 loading in the header?

Because I want to use jQuery 2.1 instead of 1.11, I first have to de-register jQuery. Then register it with the new values. : add_action( 'wp_enqueue_scripts', 'add_scripts' ); function ...
0
votes
2answers
44 views

Enqueued Stylesheets Effecting Admin Styles

I'm building a custom theme for a client and I've been adding stylesheets incorrectly for a while, so I decided to do it the correct way :-). However, when I add the stylesheet to my functions.php ...
0
votes
1answer
40 views

Enqueue less file not working in child theme?

In my child theme I have: add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . ...
0
votes
0answers
16 views

Widget Admin page and Javascript enqueuing

I am authoring a WP Widget plugin, and am having problems enqueuing javascript onto the Widget Admin page. The Javascript works when the page is first loaded or refreshed, but when you click "Save" on ...
0
votes
0answers
51 views

Prevent caching when using wp_enqueue_script?

I am using this to include a custom js file, but i notice if i update the custom-js.js file it doesn't automaticly is the one used? So how do i prevent this js file to be cached? function ...
0
votes
3answers
96 views

What does “Do not deregister the jquery script in the administration area” mean?

We all know the advantage of using cdn caching etc.. For that sake i deregistered the script and registered jquery with cdn link . But the problem is that it is showing error like this Yes Debugging ...
0
votes
1answer
56 views

How do I know if I should enqueue JS code or just include it in ONE PHP function?

I've read in tons of articles that enqueueing is the way to go...blah blah blah....but does that only apply to when the JS code itself will be repeated across many pages? For example, I have a bit ...
0
votes
0answers
20 views

Should I be worried about this error when enqueueing an external JS file? Everything still works

I enqueued a JS file that contains the below code. I can tell that the JS file is working correctly and being used. However, the browser console gives me an error Uncaught SyntaxError: Unexpected ...
0
votes
1answer
26 views

Should I be enqueueing styles/scripts once and then dequeueing them?

I'm new to WP dev and I want to add my own CSS/JS to an existing plugin via an extension that runs after the plugin has loaded (e.g. do_action('plugins_loaded')). This plugin did not have a payment ...
0
votes
0answers
23 views

List all non-admin enqueued files

I am using $wp_scripts and $wp_styles in my admin area to get a list of all css and js files on my site, but only admin registered styles and scripts are being added, I have googled and can't find a ...
0
votes
0answers
34 views

How to load default wordpress scripts

I'm displaying a custom WP_List_Table on a plugin page, and would like to use the bulk actions. However, the top checkbox doesn't let me select all checkboxes below. I have narrowed the problem down ...
0
votes
1answer
28 views

Problem in wp_localize_script

I am try to enque and localize my word-press scripts My code for for enque my scripts is function load_my_scripts() { wp_register_script('custom-js', get_stylesheet_directory_uri() . ...
0
votes
1answer
73 views

Move scripts to footer, but exclude one script?

I used a PHP script to move all scripts to the footer of my site, but some plugins don't work anymore. I used the following: // JavaScript to footer --> läd alles im footer! remove_action( ...
0
votes
2answers
34 views

wp_enqueue_scripts not enqueing correctly

I'm using Emberjs to build a front end to a WordPress site. It has two javascript files 1. vendor.js and 2. myapp.js. On Ember's dev server, the app works correctly but when I add the production ...
0
votes
0answers
44 views

Why is the Dequeue Not Working For All Plugin Styles and Scripts?

I'm trying to increase the load performance a with more sensible loading of admin scripts and styles. I am dequeueing and deregistering scripts and styles where they don't need to be loaded. I've ...
0
votes
0answers
31 views

Put dynamic Javascript in header after doing operations

I want to write a plugin that enables a function to be put in my theme in various places. Then I would like to collect the parameters called and generate a Javascript and put it into my site ...
0
votes
1answer
28 views

Video script issue, JavaScript attribute remains 'undefined'

I have a project in development and I want to use this technique to load a background video element. This should load into the large white box below the purple nav bar. So far I have added the ...
0
votes
0answers
36 views

Enqueue script multiple times?

I have a script that needs to be enqueued by a shortcode with parameters injected via wp_localize_script. The script is registers in a bootstrapping files then localized and enqueued within the ...
0
votes
0answers
32 views

wp_enqueue_scripts - force .js file to be last included file after plugin js files

I need to include a custom jquery script and need this to run after everything else. I have included it using the following code in the functions.php file: function add_custom_scripts() { ...
0
votes
1answer
61 views

Can't execute jQuery before my script

I have a very simple JS script called script_1.js sitting at the root level of my twentytwelve-child theme. This script contains only: $(document).ready(function(){console.log("scriptLoaded"); }); ...
1
vote
0answers
42 views

Attempt to change jQuery version caused White Screen of Death

I'm working on a client's WP installation, and I'm attempting to replace the default jQuery library included with WordPress to a newer version. I inserted the following script into the site's ...
0
votes
0answers
65 views

Wordpress and Raty.js

thanks in advance for any help you can provide. I am trying to implement Raty.js into a archive template for a custom post type I have created. As far as I understand I only need to enqueue the ...