add js to wordpress theme child

<?php add_action( 'wp_enqueue_scripts', 'child_add_scripts' ); /** * Register and enqueue a script that does not depend on a JavaScript library. */ function child_add_scripts() { wp_register_script( 'google-analytics', get_stylesheet_directory_uri() . '/google_analytics_object.js', false, '1.0', true ); wp_enqueue_script( 'google-analytics' ); }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.