Adding Custom JS Code via Child Theme

Sometimes a script is too complicated and needs additional php conditions or other custom code.

In case you want to use your own custom javascript code without the use of the integrated javascript editor from Theme Options, you could use the default WordPress hooks with your own function via a Child Theme.

This way you can combine javascript and php code.

Depending on the hook you can add your code either after the head tag or just below the closing body tag.

For example you could add a function like:

function grve_child_theme_print_custom_code() {
    <!-- Your custom Code -->

And use either the wp_head hook for header ( head tag )

add_action( 'wp_head', 'grve_child_theme_print_custom_code' );

or the wp_footer hook for footer( just before end body tag )

add_action( 'wp_footer', 'grve_child_theme_print_custom_code' );