The theme should enqueue styles and scripts on the wp_enqueue_scripts
hook, per Codex recommendations.
function theme_enqueue_scripts()
// register wow.js & animate.css
wp_enqueue_style( 'animate-stylesheet', get_stylesheet_directory_uri() . '/library/css/animate.css', array(), '', 'all' );
wp_enqueue_script( 'wow-js', get_stylesheet_directory_uri() . '/library/js/vendor/wow.min.js', array(), '', 'all' );
}
add_action('wp_enqueue_scripts', 'theme_enqueue_scripts' );
Then your initization script can be added to the wp_head
hook.
function wpa_135542(){?>
<script>
new WOW().init();
</script>
<?php }
add_action( 'wp_head', 'wpa_135542' );
Related Posts:
- wp_add_inline_script without dependency
- How to use wordpress default Password Strength Meter script
- What are the benefits of using wp_enqueue_script?
- Adding javascript to child theme
- Register and enqueue conditional (browser-specific) javascript files?
- wp_enqueue_script() not working at all
- How to dequeue a script?
- Any advantage of using wp_scripts and is_IE when enqueuing scripts
- How to use wp_localize_script in custom page template?
- How to use Head JS with all enqueued scripts?
- wp_enqueue_script : how to change loading order of scripts?
- Remove extra Google Maps script
- Is it possible to enqueue the Youtube API script or does it have to be inline?
- Loading different JS for http and https
- Include jQuery UI as a whole
- How to echo JS right after enqueued script to put it into noConflict mode?
- Correct place to register and enqueue scripts
- Combine enqueue js without affecting dependencies
- Load multiple Javascript scripts
- WP script versioning breaks cross-site caching?
- wp_localize_script with boolean and init
- wp_register_script multiple identifiers?
- require.js to load javascript
- wp_enqueue_script isn’t connecting my custom js file
- TinyMCE in a div / textarea on frontend?
- How to add extra attributes to the script tag added via wp_localize_script()
- How do I enqueue(or delay loading of) tags in individual page posts?
- Javascript not included
- Include Javascript as Plain (No file inclusion)
- Move all the JS files to the bottom|footer, the right way
- wp_enqueue_script adds only the first script
- How to add JavaScript file using wp_enqueue_scripts?
- Is it mandatory to enqueue any kind of Javsacript?
- Can the index.asset.php file be used with the enqueue_block_editor_assets action?
- wp_enqueue_scripts is not working in my plugin
- How to place script in footer?
- Enqueue script if screen is greater than 500
- Trying to integrate Zoho Campaign Form [closed]
- Script Localization doesn’t work
- Enqueue Javascript After ALL Other Scripts (Including Async Scripts)
- Enqueue js script to footer
- Enqueueing a script and a style sheet not working
- What is the “proper” way to generate a javascript variable depending on a custom field value?
- Adding a Javascript slideshow to the home page
- Is there a way to check for an attribute of a script when using script_loader_tag?
- Enqueue scripts all over but not in single.php
- Media library not working with wp_editor() on the front end
- Override do_item() Function to Add Extra Attribute to Scripts
- Proper way to enqueue a generated script that isn’t in a .js file?
- Enqueue scripts based on browser width?
- wp_enqueue_script not loading my custom js file
- Correctly enqueue scripts of type=text/paperscript (PaperJs Library)
- Scripts not loading through function Method in WordPress Theme
- How to execute Javascript on a WordPress page?
- Why is JavaScript being added to header as application/oembed?
- wp_enqueue_scripts not enqueing correctly
- Javascript on Registration Page
- Do I just put the html in a page when enqueueng or do I also have to reference js file from the html page [closed]
- Javascript asset not enqueuing with the rest
- Add crossorigin to SCRIPT tag
- Add script to page at certain location in wordpress
- WordPress wp_enqueue_script only adds text to top of page source
- Getting a variable inside foreach from PHP to JS after localization
- get_header() in backend – but keep JavaScript and CSS files
- Including Styles and JS files to work ON my plugin interface
- JavaScript Libraries in WordPress
- Linking wp_enqueue can’t find the javascript file (adds “?ver=x.x.x” to the src)
- Failing to load my script files in wordpress! i can’t figure out what i’m doing wrong
- wp_enqueue_script does not recognize my js file?
- What to include to use jQuery UI Auto Complete
- JS / jQuery in Elementor pages vs JS file
- Load JavaScript on specific page with @wordpress compiler
- How to load Javascript code or functions.php later in a child theme?
- Enqueued script fails
- Script Loaded in WordPress but won’t run
- Loading two versions of same JS libary
- Proper way of minifiying java script files in wordpress theme
- Escaping quotes while enqueuing scripts
- How to register or enqueue script and stop it being called in head?
- How to correctly load this jquery script through the file functions.php?
- Adding javascript script to header via functions.php
- adding script tag in head of specific pages
- How to delay display of page elements until enqueued script has injected html
- load-scripts.php loads incorrect file names
- Enqueue concatinated JS file in WordPress
- wp_enqueue_scripts doesn’t work for template pages
- JavaScript and Google PageSpeed + wp_enqueue_script
- Javascript file doesn’t load
- Put dynamic Javascript in header after doing operations
- Dequeue set-post-thumbnail.min.js
- Why can’t I load JS script in a plugin?
- PHP or JS for header image rotator?
- convertEntities() used before it is defined
- JavaScript file successfully registered but does not render correctly
- wp_enqueue has a resource but doesn’t generate a script tag [duplicate]
- Javascript not working on index.php but it is working on single post’s page
- Orbit Slider and Events Manager Plug-in JavaScript
- How to load JavaScript modules with script_loader_tag hook?
- Uncaught ReferenceError: tippy is not defined
- How to securely set dynamic HTML content with JavaScript?