Unable to declare AOS library in functions

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>

Loading two versions of same JS libary

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

How to enqueue a script on a specific URL that contains multiple parts

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

How to make JQuery load on top of head tag before everything

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