plugins_url not returning correct directory
plugins_url not returning correct directory
plugins_url not returning correct directory
The function get_template_directory_uri() returns the path without trailing slash. So you need to write wp_register_script( ‘aosjs’, get_template_directory_uri() . ‘/js/aos.js’,…) Note the slash before “https://wordpress.stackexchange.com/questions/328563/js/aos.js”. What good for is this line, the script file should already be loaded: <script src=”https://wordpress.stackexchange.com/questions/328563/js/aos.js”></script>
Such a dummy! Turns out that since I was wp_enqueque for the JS script with the footer. I had commented out get_footer(); in my single.php page and as a result was not loading.
sweetalert.js uses the global swal in both version 1.*.* and version 2.*.* of its library. Therefore if you load both js/sweetalert.min.js and js/sweetalert-latest.min.js the first one to define the global swal will be used, the second will be ignored or cause a console error. To prevent this only load one library such as: // PHP … Read more
is_page() accepts only one optional parameter $page which should be (int|string|array) representing Page ID, title, slug, or array of such. On a standard WP installation your code should look like this. add_action( ‘wp_enqueue_scripts’, ‘enqueue_date_picker_styles_and_scripts’, 101); function enqueue_date_picker_styles_and_scripts() { if ( is_page(‘page-slug-here’) ) { // Replace page-slug-here with slug of page at races/community/add wp_enqueue_style(‘bootstrap-datepicker-css’, ‘//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/css/bootstrap-datepicker.standalone.css’); wp_enqueue_script(‘bootstrap-datepicker-js’, … Read more
The function wp_register_script has a parameter called $in_footer. Setting this to false will add the script to the head. wp_register_script( string $handle, string|bool $src, array $deps = array(), string|bool|null $ver = false, bool $in_footer = false ) In addition, if you deregister jquery, you can manually add the script in your head above wp_head(). This … Read more
You don’t strictly need wp_register_script() but it is considered a best practice to use it as it allows other developers to programmatically work with the order and list of scripts being included. Regarding your issue, your code looks correct. Be sure to call it inside the wp_enqueue_scripts action (but I don’t think that’s influencing the … Read more
So, the success function in the ajax function has to look like the following: success: function(html){ console.log(‘success’); $( ‘#results’ ).html(html); $( ‘#results .usermanagement_select’ ).select2({tags: true}); }
Scripts and stylesheets failing to load in Chrome IOS (and only Chrome IOS)
How to avoid conflict if a plugin already have included open library?