Initiating wow.js inside of WordPress
-
I have found a tutorial on initializing the wow.js inside of WordPress but struggling to get it to work. Can anyone please advise?
I have added the following to functions.php:
//* Enqueue Animate.CSS and WOW.js add_action( 'wp_enqueue_scripts', 'sk_enqueue_scripts' ); function sk_enqueue_scripts() { if ( is_home() || is_archive() ) { wp_enqueue_style( 'animate', get_stylesheet_directory_uri() . '/css/animate.min.css' ); wp_enqueue_script( 'wow', get_stylesheet_directory_uri() . '/js/wow.min.js', array(), '', true ); } } //* Enqueue script to activate WOW.js add_action('wp_enqueue_scripts', 'sk_wow_init_in_footer'); function sk_wow_init_in_footer() { if ( is_home() || is_archive() ) { add_action( 'print_footer_scripts', 'wow_init' ); } }
When viewing page source on webpage, the links work correctly. The bit I’m struggling with is when adding:
//* Add JavaScript before </body> function wow_init() { ?> <script type="text/javascript"> new WOW().init(); </script> <?php }
Am I missing some tags? my script (footer.php):
<div id="footer">©<?php echo date("Y"); echo " "; bloginfo('name'); ?></div> </div> <?php wp_footer(); ?> function wow_init() { ?> <script type="text/javascript"> new WOW().init(); </script> <?php } </body>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Initiating wow.js inside of WordPress’ is closed to new replies.