the second js file enqueued inside wp plugin isn’t read
Problem resolved: Thanks for your time and help. Jquery must be called like that, It’s a mistake from me. (function($){ $(document).ready(function() { }); })(jQuery);
Problem resolved: Thanks for your time and help. Jquery must be called like that, It’s a mistake from me. (function($){ $(document).ready(function() { }); })(jQuery);
Uncaught ReferenceError: custom_ajax is not defined
The section titled Live rendering in the block editor on the WordPress documentation page, Creating dynamic blocks, has sample code demonstrating how to use server-side rendering. The documentation page says: Gutenberg 2.8 added the <ServerSideRender> block which enables rendering to take place on the server using PHP rather than in JavaScript. Rather than setting edit: … Read more
How to defer block.json scripts?
Dequeue/deregister scripts for everybody but the administrator
The id attribute was added to the <style> tags in WordPress v4.1 (2014) — see the Trac changesets 29956 and 29958 which both mentioned ticket #30032 (“Add ID attribute to style element from wp_add_inline_style()“): In order to support partial preview refreshes (#27355), it is important for all partials being updated to have an element with … Read more
As the “Error Message” (which is in fact a “doing it wrong”-message) is telling you, you’re using the wrong hook: Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Just read about hooks, wrap your code in a callback and then register it properly on one of the … Read more
Your scripts and styles all share the same handle, “fancybox”, which should be unique, and I think that’s your issue. Try this: wp_register_script( ‘mousewheel’, get_stylesheet_directory_uri(‘/js/jquery.mousewheel-3.0.6.pack.js’, __FILE__), array(‘jquery’), ‘3.06’, true ); wp_register_script( ‘fancybox-script’, get_stylesheet_directory_uri(‘/js/jquery.fancybox.js’, __FILE__), array(‘jquery’), ‘1.0’, true ); wp_register_script( ‘fancybox-pack’, get_stylesheet_directory_uri(‘/js/jquery.fancybox.pack.js’, __FILE__), array(‘jquery’), ‘1.0’, true ); wp_register_script( ‘fancybox-buttons’, get_stylesheet_directory_uri(‘/js/jquery.fancybox-buttons.js’, __FILE__), array(‘jquery’), ‘1.0’, true ); wp_register_script( … Read more
From http://codex.wordpress.org/Function_Reference/wp_register_script: <?php wp_register_script( $handle, $src, $deps, $ver, $in_footer ); ?> This means you need to add the $deps and $ver values to wp_register_script() in order to set $in_footer. Like this: wp_register_script( ‘justifiedGallery’, plugins_url(‘js/jquery.justifiedGallery.min.js’, __FILE__), false, // or array(), or array(‘jquery’) if this depends on jQuery ‘1.0’, // or your plugin version, or the version … Read more
If you are trying to add Jquery lib for your theme then consider using wp_head() just above closing < /head > tag. WordPress automatically adds a Jquery by default. You need not to add the lib file/ url manually.