Greeting WP Devs,
I am planning to transfer the script libraries in my function.php . In my function.php I registered AOS
function mypage() {
if ( is_page( 'mypage' ) ) {
wp_register_script( 'aosjs', get_template_directory_uri() . 'js/aos.js', array( 'jquery' ), NULL, false );
wp_enqueue_script( 'aosjs' );
wp_enqueue_script( 'jquery.min' );
add_action( 'wp_enqueue_scripts', 'testingarea');
Page Name : mypage
https://mysite/mypage/ - My script has cdn with AOS.init
<script src="js/aos.js"></script>
<script>
AOS.init({
easing: 'ease-in-out-sine'
});
</script>
First Test- AOS is registered in functions.php aand in mypage I removed the cdn in the mypage Page and aos init is still there but the result is
..
PLease kindly give me suggestions on how to declare this properly.
Greeting WP Devs,
I am planning to transfer the script libraries in my function.php . In my function.php I registered AOS
function mypage() {
if ( is_page( 'mypage' ) ) {
wp_register_script( 'aosjs', get_template_directory_uri() . 'js/aos.js', array( 'jquery' ), NULL, false );
wp_enqueue_script( 'aosjs' );
wp_enqueue_script( 'jquery.min' );
add_action( 'wp_enqueue_scripts', 'testingarea');
Page Name : mypage
https://mysite/mypage/ - My script has cdn with AOS.init
<script src="js/aos.js"></script>
<script>
AOS.init({
easing: 'ease-in-out-sine'
});
</script>
First Test- AOS is registered in functions.php aand in mypage I removed the cdn in the mypage Page and aos init is still there but the result is
..
PLease kindly give me suggestions on how to declare this properly.
Share Improve this question asked Feb 13, 2019 at 10:03 Sasuke ScendSasuke Scend 32 bronze badges1 Answer
Reset to default 0The 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 "js/aos.js".
What good for is this line, the script file should already be loaded:
<script src="js/aos.js"></script>