Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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, ...

4
votes
2answers
52 views

Removing specific style from wp_head

I'm not a WordPress developer, I'm trying to help a friend who has a WordPress website. Here is the problem: In the template, wp_head() function adds bunch of styles and scripts. I want to remove ...
2
votes
1answer
22 views

Can't get JS code to work with shortcode

I am trying to create a plugin and I've got stuck. I am trying to register and enqueue a script from a shortcode: This is my shortcode: add_shortcode( 'gear-guide', 'gg_product_front_end' ); This ...
2
votes
3answers
57 views

wp_enqueue_script being ignored in custom theme

I am trying to enqueue a js file (calculator.js) from my theme's functions.php file. I have a desktop theme and a smartphone theme, and I am using a plugin to switch between the two themes depending ...
1
vote
3answers
28 views

Load JS Script only for custom post types

I am using this code and I am not sure why the script is not loaded. I believe the syntax is correct since I am trying to load the script only on the "events" custom post type single posts. ...
1
vote
0answers
27 views

Why won't my scripts load?

I am having trouble loading scripts in functions.php I've done this before so I'm sure I'm overlooking something but as far as I can tell it is correct and I have tried copying and pasting from other ...
1
vote
1answer
23 views

wp enqueue script- jQuery not loading

i have added this code to add jQuery wp_enqueue_script( 'jqueryadd','http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js', array(),'22.23',true ); But i think that this is unnecessary ...
0
votes
2answers
24 views

Trying to enqueue script - Nothing Happens

I am trying to enqueuer a script after registering it but I am getting an error. This is the script: function _test() { console.log("Test"); } That's the PHP: function fsg_shortURL() { ...
0
votes
0answers
15 views

JQVMAP not working after proper wp_enqueue_script usage [closed]

So I worked at this for awhile and I found other people having problems with JQVMap. I'm not sure if there is some JQuery conflict, I did test registering a newer JQuery, but I'm not interested in ...
0
votes
1answer
23 views

Proper way of minifiying java script files in wordpress theme

How can make sure that java script minification in wordpress does not create issues once it is done in theme development point of view? Does wp-enqueque script order matter in minification process? ...
1
vote
0answers
23 views

How to enqueue or include json file to a plugin

I have a file called settings.html that includes two files in the footer which are a javascript file and a json file. <script src="script.js"></script> <script src="settings.json">&...
0
votes
0answers
13 views

Enqueuing multiple stylesheets with a child theme

I've successfully enqueued a parent stylesheet and child stylesheet. I'd like to enqueue a third - ultimately a style.php file, but a second-style.css would be a good start. It's not working for me ...
0
votes
0answers
28 views

WP Enqueue Script Error

Hi I am struggling to figure out why most of scripts are not working, mostly the owl carousel. The error I could not figure out is Uncaught TypeError: $ is not a function at scripts.js:1 I tried ...
1
vote
1answer
38 views

How to add Bootstrap Tour JavaScript to WordPress Admin Panel Dashboard Widget

I am developing a theme and want to know how to add Bootstrap Tour Script to a Custom Dashboard Widget. Basically I want to include the Bootstrap Tour Script to the Admin Panel so I can write a ...
0
votes
0answers
27 views

How to move medielement scripts to footer?

This seems like a new thing since 4.9 https://make.wordpress.org/core/2017/10/30/mediaelement-upgrades-in-wordpress-4-9/ In previous versions medielement and dependencies were all loading in footer ...
0
votes
1answer
19 views

How to import the css in the plugin admin area?

I am trying to insert it using the following code. The css file style.css is just inside the plugin's directory. add_action('wp_enqueue_scripts', 'callback_for_setting_up_scripts'); function ...
1
vote
1answer
124 views

how to use wp_localize_script in custom page template

I have the template called homepage that assigned to home page and bottom of a template I have script tag. now I want to use my json in that script tag. home-template.php add_action('...
0
votes
0answers
53 views

Using Anime.js on a WordPress site

I'm trying to get anime.js to work on a WP site but getting nowhere. I'm loading it in functions.php (wp_enqueue_script, add_action) together with a script file I'm calling it from. I can see the ...
0
votes
2answers
124 views

How to en-queue bootstrap 4 to theme?

i tried enqueue the bootstap with functions php wp_enqueue_style('bootstrap4', 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css'); wp_enqueue_script( 'boot1','https://code....
0
votes
1answer
16 views

wp_enqueue_scripts are apearing inline rather than as links

I'm not sure whats going on with my code here, I'm enqueuing scripts like so: wp_enqueue_script( 'lightbox', '/wp-content/themes/'.get_stylesheet() . '/js/lightbox.js'); However when I view the ...
0
votes
2answers
12 views

How can I load an inline script after the enqueued scripts in admin?

I am having a heck of a time finding an answer to this solution. I have googled everything I can think of but I can't find anything. I want to load an inline JavaScript tag in the footer of the admin. ...
0
votes
0answers
14 views

Adding links to .js and .css files on specific custom pages

Is there a plugin or setting in WP that will allow me to include JS/CSS file links (both internal and external) on custom pages? Currently I have skin options for Custom CSS, JS Code before </head&...
0
votes
2answers
55 views

Problem in functions.php file

I'm trying to include all my css and JS files of a theme using functions.php. Following is what I have done so far: <?php function blogroom() { wp_enqueue_style('bootstrap', ...
0
votes
1answer
47 views

enqueing Javascript and CSS

Whenever I check my website on gtmetric, google Insights, Pingdom etc... I always get feed back of render blocking JS Currently I enqueue all my scripts as so: <head> <link rel="...
0
votes
0answers
24 views

Javascript not being loaded only in custom taxonomy template

I have a taxonomy called categorias_de_receita in my plugin and a custom template for displaying this taxonomy posts. I don't know why Javascript files are not being loaded only in this specific ...
0
votes
0answers
27 views

removing and readding jquery from a theme

Since the last update to WordPress, I have noticed that on my BBPress pages I have jquery and jquery.min enqueued. I'm guessing it has something to do with jquery migrate but I don't know for sure. ...
0
votes
1answer
101 views

wp_enqueue_script called incorrectly

I've spent the better part of four hours trying to solve this freaking problem and am losing my mind. [16-May-2018 20:57:32 UTC] PHP Notice: wp_enqueue_script was called <strong>incorrectly&...
0
votes
2answers
74 views

Enqueued JavaScript is not working

I've ecountered many problems while creating my own WordPress Theme and this is not different. Except that I can't find a solution. I'm good with HTML and CSS, but I know little to nothing from ...
0
votes
0answers
91 views

Load Scripts after Ajax page change

I'm working on converting some html/css into a wordpress theme. Our site has a audio stream player in the header. If the page changes, the stream should keep playing. As such, I found a plugin for ...
0
votes
2answers
90 views

How can I integrate Fancybox 3 in Wordpress properly

I would like to integrate Facybox 3 in my WordPress (only on posts). It works but I'm a bit bothered cuz the initialize script is loaded after the core minified fancybox js. So, here is the code I ...
3
votes
1answer
40 views

How do you enqueue script tags for ReactDOM in WordPress' functions.php?

I'm torn where the best place for this question to go but when researching the React crossorigin purpose I found the answer on MDN: crossorigin Normal script elements pass minimal information to ...
0
votes
1answer
17 views

Custom plugin - load enqueue only for this plugin

I have made my own plugin, which works fine, but I'm enqueueing (is that a word?) bootstrap, which then loads cross-site (admin). I found some workarounds, but the current workaround I'm trying throws ...
0
votes
1answer
227 views

Enqueuing External Javascript functions.php

For some reason I cant seem to enqueue external JS files. I can enqueue external css files but not the JS files. I have a custom theme using the bootstrap css frame work. My functions.php is as ...
0
votes
0answers
17 views

Trouble making a modal box in my plugin

I'm trying to create a modal box on my wordpress, and I've followed instructions on this website: https://www.w3schools.com/howto/howto_css_modals.asp But when I try it, I can't find the script ...
0
votes
1answer
35 views

Difficulty loading jQuery with wp_enqueue_script

forgive me but I am an amateur so I have limited knowledge. I want to know the best way to add jQuery to my custom WordPress theme. Previously I just used the following code: <script src="https://...
0
votes
1answer
151 views

Enqueue script dinamically

I want to enqueue a script dynamically with Ajax. In a page there is a button that on click call the script button-script.js. This is the code: // Enqueue Ajax call add_action('init', '...
4
votes
3answers
445 views

wp_add_inline_script without dependency

I have a javascript snippet that I want to inject into the footer of the page. It's a tracking code, let's say similar to Google analytics. It has no dependencies, it's a standalone snippet. I can ...
0
votes
1answer
142 views

Relative path instead of absolute for wp_enqueue_script

When you enqueue scripts or styles with the following: function themeslug_enqueue_style() { wp_enqueue_style( 'core', '/style.css', false ); } add_action( 'wp_enqueue_scripts', '...
0
votes
0answers
12 views

How to combine wordpress and amd loaders?

I have the following problem. In the admin area, I enqueue DataTables and Select2. All works fine, but when I want to connect Dojo Toolkit, I get an error: Uncaught TypeError: $(...).select2 is not a ...
0
votes
0answers
21 views

Enqueue Script only over specific WordPress core file

I want the way to register the script file only over one of the WordPress core files for example only over the header.php file. Fore register the scripts over specific page and template we use one of ...
1
vote
2answers
32 views

How to remove scripts/style added to customize_controls_enqueue_scripts hook by current active theme

I am looking for a way to remove/unhook all assets (css and javascript) files added to customize_controls_enqueue_scripts hook when the query string mo-reset=true is added to the customize url.
1
vote
0answers
15 views

Making sure that a plugin's scripts and stylesheets are included for dynamicaly loaded content

I'm currently making a theme that uses admin-ajax.php to dynamicaly load pages and posts. Some of this content uses plugins like final tiles gallery and Video Embed & Thumbnail Generator. If ...
1
vote
1answer
76 views

Conditionally dequeue dependency of scripts

Please note that, I'm not telling about conditionally enqueue/dequeue scripts, I'm referring to conditionally dequeue certain dependencies from an existing enqueued scripts in front end. And please ...
0
votes
1answer
44 views

wp_enqueue_scripts is not working in my plugin

Here is my code: <?php /* Plugin Name: Awesome Form Validation Plugin URI: http://itexpertbd.com Description: Use 'required' class to enable an input as required. Version: 1.0 Author: ...
0
votes
2answers
36 views

wp_enqueue_script silently fails [closed]

I created a plugin which uses bootstrap datetimepicker. So i load corresponding js setting dependancies like this: wp_enqueue_script('medapp-datetimepicker-js', $medapp_boot_timepicker_js, array( ...
0
votes
2answers
115 views

Load custom CSS before admin CSS

I am trying to use the jQuery Datatables plugin in my WordPress dashboard but the native WordPress admin CSS styling is overiding the datatables CSS, I am calling them like this... add_action('...
0
votes
1answer
113 views

Correctly enqueue scripts of type=text/paperscript (PaperJs Library)

I need to use Paper.js (http://paperjs.org/), and specifically one of their examples (http://paperjs.org/examples/smoothing/) on a WordPress website. Usually, scripts are enqued to WP with a PHP ...
-1
votes
1answer
91 views

How can I dequeue a Plugin Stylesheet?

I am currently using a Plugin, which has created a Stylesheet within the following directory: /wp-content/uploads/plugin-name/css. I would like to remove this Plugin's Stylesheet, since it is being ...
0
votes
1answer
120 views

How do I dequeue a Stylesheet, stored in an 'Assets' folder?

How do I dequeue a CSS Stylesheet located in wp-content > themes > theme-name > assets > css > theme-skin > color.css? The outputted code, within the Source Code, is: <link rel='...
1
vote
2answers
38 views

How can I make sure my JS script gets executed first, among other scripts?

I have this script that cuts down my menu and adds a "+" dropdown if there are too many menu items in an attempt to prettify long menus, as such: Without the script running: Which I call in ...
0
votes
2answers
149 views

correct path for enqueue script in WordPress

I have this action: add_action( 'wp_enqueue_scripts', 'my_custom_script_load3' ); function my_custom_script_load3(){ wp_enqueue_script( 'my-custom-script3', '/members/user.js' ); } It works great ...