Questions tagged [wp-enqueue-script]

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, or provide this function with all the parameters necessary to link a script. This is the recommended method of linking JavaScript to a WordPress generated page.

Filter by
Sorted by
Tagged with
1
vote
1answer
913 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
47 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
1answer
36 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
608 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
375 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
257 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
487 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
1answer
32 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 ...
6
votes
1answer
11k 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 <?php add_action('...
3
votes
2answers
17k 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
38 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 ...
1
vote
2answers
1k 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
2answers
101 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
622 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
59 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 ...
1
vote
1answer
2k 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
1k 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
2answers
3k 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
608 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
96 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 ...
1
vote
2answers
3k 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
1answer
102 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://...
1
vote
1answer
2k 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', '...
13
votes
3answers
9k 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
780 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
30 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
103 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
19 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
2k 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 ...
1
vote
1answer
274 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
383 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
508 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
2answers
358 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
vote
2answers
4k 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
507 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='...
2
votes
2answers
291 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
1k 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 ...
0
votes
1answer
95 views

Ajax Response Error | just getting error as the response

Below is the code for the AJAX File. alert(cont) is given the correct result but the problem is with the response. I am just getting error as the response. function updateRadioButton(rating,pid){ ...
1
vote
1answer
102 views

How do you output enqueued scripts to an admin page?

I am venturing into creating my own plugin (for learning and site development) and haven't found an answer to this yet. I managed to find a piece of code on stackexchange to print a list of the ...
0
votes
1answer
769 views

Add a Script button in W3 Total Cache plugin not working due to conflicting jQuery version

While trying to fix the Render-Blocking issue on my website, I ran into a problem with the W3 Total Cache plugin on its Minify settings page. The two buttons to add JS (Add a script) and CSS (Add a ...
2
votes
1answer
788 views

Custom data-id wp_enqueue_script

I need to insert something like this in wordpress: <script id="customID" data-name="customDataName" src="https://url.com/main.js"></script> I am using wp_enqueue_script but I can not ...
0
votes
1answer
1k views

How to insert html/css/javascript code to wordpress plugin

I'm trying to show a modal dialog when user get registered (action_hook: user_register) using the woocommerce plugin, but without having any result. I would appreciate any help! The code is shown ...
0
votes
1answer
238 views

add WordPress script to page conditionally by category

I use a plugin "Post Tags and Categories for Pages" which adds categories to pages. My intention is to enqueue an external script on a page, only when it's needed. So if I assign a page to a ...
0
votes
1answer
937 views

Child theme stylesheet not always overriding “index”

I'm using a child theme and I'm using a "styles.css" file to override things from the parent theme. My styles (there are many stylesheets) are enqueued like this: function my_theme_enqueue_styles() { ...
0
votes
0answers
68 views

map enqueue in backend

I enqueued a script like google-map. I enqueued in front-end and this works well. (I edited my key in url) add_action('wp_enqueue_scripts', 'enqueue_fn'); function enqueue_fn(){ ...
0
votes
1answer
373 views

Using function from enqueued .js file in theme in plugin?

I am developing a theme as well as a few plugins that go along with it. I'm having trouble figuring out dependencies of enqueued files between a theme and a function. If I enqueue a custom .js file in ...
1
vote
0answers
267 views

Enqueue customizer scripts that are bundled by webpack?

I am adding some customizer controls to the theme, and I have a question on adding customize scripts and preview scripts when using bundler such as webpack. All my theme assets (scss, js, images etc.)...
0
votes
1answer
40 views

Theme JS is available but theme CSS isn't

In functions.php I used the following code to enqueue assets, but for some reason all CSS is ignored (JS isn't ingonred): function my_theme_enqueue_assets() { wp_enqueue_style( 'parent-style', ...
1
vote
2answers
3k views

How to remove some external js files from source?

I need to remove some external .js files from source here is source: view-source:buhehe.de/ausmalbilder/ There is 3 jquery library and I don't know what is difference, why is it not one enough? <...
0
votes
2answers
1k views

wp_dequeue_style and wp_dequeue_script not working on server but does work on local xampp

This is my entire code and it is working perfectly in my local system xampp but not working on server. function taqyeem_dequeue_scrips() { if(basename($_SERVER['REQUEST_URI'])=='my_page' || ...

1 2 3
4
5
20