Add custom JavaScript ONLY to the homepage and the footer?
-
I’d like to add a little bit of JavaScript to the footer of my homepage and for it to be inline – i.e. published on the page since I believe that this is best for loadings peed.
Here’s my code:
I believe that this might be the better approach:
function add_inline_script() {
echo “<script>/* do awesome things */</script>\n”;
}
add_action( ‘wp_footer’, ‘add_inline_script’, 0 );Is this the best approach for OceanWP? Thanks!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Add custom JavaScript ONLY to the homepage and the footer?’ is closed to new replies.