Skip to main content

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
0 votes
0 answers
33 views

I am trying to make use of modules for our WordPress codebase. I was able to figure out how to enqueue my script file, add the module type to the script tag, then using wp_add_inline_script I was able ...
ProfoundHypnotic's user avatar
0 votes
1 answer
242 views

Please help! I updated my php to 8.0 and my WordPress install to the current version (6.7.1), and now get the following warning messages on my site: Warning: Undefined variable $post in /home/...
stacy's user avatar
  • 1
0 votes
0 answers
32 views

I am currently developing a plugin and I need to get the handlers of various enqueued files in the theme. I have tried working with global $wp_scripts and global $wp_styles, but I only get the scripts ...
David's user avatar
  • 1
2 votes
0 answers
127 views

I am working on a WordPress project using version 6.5, which introduced support for JavaScript modules. I have a parent theme that exports a JavaScript class, and I want to import this class in a ...
Nani samireddy's user avatar
2 votes
1 answer
377 views

I recently developed a custom Gutenberg block by utilizing the @wordpress/create-block package, which effectively generated a full plugin framework. I simply needed to tweak some existing files to get ...
Daniel V.'s user avatar
  • 151
2 votes
1 answer
409 views

I am building static block slider (Swiper JS). Used wordpress/create-block https://developer.wordpress.org/block-editor/reference-guides/packages/packages-create-block/. Besides importing the JS & ...
Ion T's user avatar
  • 45
0 votes
1 answer
78 views

I'm developing a plugin that may also be used as a library in themes or plugins. I need to enqueue a custom script, but I cannot know the absolute path to the script, as the final location of the ...
Gerard Reches's user avatar
0 votes
1 answer
52 views

I'd like to know if is there any method that allows to include scripts on specific pages/templates depending if those page have a specific get_template_part inside. Example: I have more than one page ...
MKay's user avatar
  • 179
0 votes
0 answers
81 views

I have this code in a plugin class DashboardCustomizer { public function __construct() { add_action( 'admin_enquque_scripts', array( $this, 'load_custom_scripts' ) ); } /* ...
OHICT's user avatar
  • 133
1 vote
1 answer
409 views

We used to have the following script in functions.php that worked for many years: add_action('wp_enqueue_scripts', function () { wp_enqueue_script('swiper-script', 'https://unpkg.com/swiper@8/swiper-...
th00ht's user avatar
  • 184
0 votes
1 answer
30 views

Here is my functions.php <?php function my_custom_theme_styles() { // Enqueue your custom stylesheet named "style.css" wp_enqueue_style('style', get_stylesheet_uri()); } ...
bpub's user avatar
  • 1
1 vote
2 answers
479 views

I am developing a plugin that uses some external PHP library. That PHP library uses js and CSS. I want to enqueue that external library js and CSS using the Wordpress enqueue functions in Wordpress ...
SDeveloperj's user avatar
0 votes
1 answer
365 views

I'm writing a simple wordpress theme. I've added this function inside the functions.php file and I've noticed that only style.css is loaded. Is there something wrong that will cause that the other ...
OHICT's user avatar
  • 133
1 vote
1 answer
1k views

I want to create a Gutenberg block that uses React on the client rendered page (not the admin pages). Is React code split from the rest of Gutenberg? If so, how can I enqueue that specific bundled ...
lookyhooky's user avatar
1 vote
0 answers
238 views

My menu code: add_action('admin_menu', 'waf_admin_menu'); function waf_admin_menu(){ add_menu_page('WordPress Audio Filter', 'WordPress Audio Filter', WAF_CAPABILITY, 'waf_settings', '...
Toniq's user avatar
  • 455
0 votes
0 answers
204 views

I have a textarea on a public-facing page. I want to add Gutenberg editor to that textarea. I searched the official documentation but couldn't find anything. Any information will be helpful.
Salekin's user avatar
0 votes
3 answers
1k views

I wrote the following code in a standalone plugin, but it doesn't work Please guide me how to modify the code, so the JS file is loaded. <?php /* Plugin Name: Copy post */ class CopyPostApi{ ...
Fardad Farhang's user avatar
1 vote
1 answer
524 views

Description I have implemented a frontend script that gets a few text options from the server via wp_add_inline_script. When the user does an action the content should dynamically change to one of the ...
Josef Wittmann's user avatar
0 votes
0 answers
517 views

Currently getting this warning in php. Warning: filemtime(): stat failed for https://madeupurl.com/wp-content/themes/madeup/assets/js/scripts.js in /var/www/wp-content/themes/madeup/functions.php on ...
HomeWell Web's user avatar
0 votes
1 answer
297 views

When you enqueue a script the id="" attribute and the script handle (appended with the -js or -css termination) are automatically added to the generated <script> or <style> tag. ...
amarinediary's user avatar
0 votes
0 answers
64 views

I'm facing a very peculiar issue where the bootstrap css is working fine but the js is not working. The js shows in the page source. I am using cdn but I have also tried by downloading the bundle and ...
Patrick2997's user avatar
0 votes
0 answers
153 views

The issue is that we need to replace some HTML based on the user's user agent string but by the time the JS code is loaded and runs, the user is already interacting with the page. Is there some way to ...
Slbox's user avatar
  • 109
0 votes
2 answers
4k views

I am trying to add google fonts to a custom WordPress theme. Therefore I tried to enqueue selected three font faces at once to make it fast loading. So, I use the below codes to register and enqueue ...
user2584538's user avatar
0 votes
1 answer
1k views

I'm creating a theme and i want to upload it to envato. I have a javascript file that is type module and i can enqueue it and then use script_loader_tag filter to add type module to it by these lines. ...
Hosein's user avatar
  • 1
1 vote
1 answer
1k views

I'm trying to use the Bootstrap collapse component and just can't get it to work. I believe the HTML is proper, but whenever I click on the element that should trigger the collapse, I get an Uncaught ...
Tatex's user avatar
  • 33

1
2 3 4 5
22