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
2answers
48 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
28 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
81 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 ...
11
votes
2answers
7k 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
55 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
33 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
60 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
96 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
77 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
51 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
226 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
96 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
112 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
145 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
66 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
63 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
24 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
131 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
218 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
60 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
23 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
27 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
43 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
37 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
48 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
128 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
40 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
80 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
45 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
30 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
49 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
51 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
93 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
48 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
97 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 ...
0
votes
0answers
38 views

How to get all enqueued scripts on specific post/page?

I can easily display all the enqueued scripts using the code below: add_action( 'wp_footer', 'lists_of_active_scripts' ); function lists_of_active_scripts() { global $wp_scripts; echo ...
0
votes
1answer
53 views

Load same stylesheet for front end and wp-admin

How can i load same style sheet for both front end and wp-admin of a wordpress site
0
votes
1answer
30 views

Scripts not loading when using the wp_enqueue_scripts action

Really basic, I'm afraid. My scripts aren't loading when I put them as part of a function triggered by the wp_enqueue_scripts action in functions.php. If I put them outside of that action as part of ...
0
votes
2answers
85 views

How to load API's in WordPress?

I am trying to learn WP Theme development. And I am wondering what's the proper way to load api's? For example Google Maps: <script src="http://maps.googleapis.com/maps/api/js"></script> ...
1
vote
0answers
94 views

Trigger a php file on every post or page if a condition is met

I was wondering if we can trigger a PHP file on every WordPress post or page if a certain condition is met. Let me detail what I want. Can we write a simple PHP script that will be automatically ...
0
votes
2answers
120 views

Load stylesheet on custom admin submenu page

I'm trying to load a stylesheet for a particular admin submenu page. The code below is what I came up with after looking up admin_enqueue_scripts in the codex: function my_function($hook) { if ( ...
2
votes
1answer
399 views

When can you get current page ID and initialize hooks right after?

I'm developing a plugin and need to know on what page user is and then add specific hooks and filters for that page. And my problem is that is_page() and the_ID() doesn't work outside of wp, ...
0
votes
0answers
55 views

Safari only bug: script enqueuing blocks other scripts

Looking for some advice. One page of my blog is an angular app that is loaded via systemjs. It loads fine in Chrome (and firefox) on my computers and Android phone. But Safari is very erratic and ...
0
votes
0answers
75 views

How to wp_enqueue_script with html?

I want to wp_enqueue_script multiple javascript with html and css. I place the html code in a page, but it's not working on my side. Only plain text is displayed. Here's the link: ...
0
votes
1answer
259 views

Which are the MediaElement.js scripts to enqueue

I'm loading (paging) posts with ajax, so I want to be able to render videos using MediaElement.js on newly appended content. I already have my script working but is failing if no video posts are ...
0
votes
0answers
25 views

How to list the scripts and styles enqueued for a certain page?

How do I get all the scripts and styles used on a certain WordPress page. I would like to see the following, Name of script/style URL to script/style Version of script/style And if a certain script ...
0
votes
1answer
31 views

Register script in one plugin, and enqueue it in another

I need to register a script in one plugin and enqueue it in another. This is not working the way I expect it would. Am I missing something? Plugin that registers script: add_action( ...
0
votes
1answer
199 views

Enqueueing a script and a style sheet not working

I am trying to enqueue both a child theme style sheet and a child theme script. I need to enqueue the script because I put CDN links in there for Bootstrap. I know my enqueue isn't working correctly ...
0
votes
0answers
30 views

Enqueing Scripts

Perhaps more of a verification question for me... My plugin uses a few JS files which it enqueue's, however I am finding that in some instances of WordPress and some Themes the JS is not working as ...
0
votes
0answers
127 views

After wordpress widget save (ajax call) tinymce editor gone, data not saved

I have made tinymce editor for textarea fields in widgets. I'm enquing scripts: wp_enqueue_script('tinymce', home_url() . '/wp-includes/js/tinymce/tinymce.min.js'); wp_enqueue_script('tiny', ...