How To Add GTM, Google Analytics Or Other Third Party Scripts In Litho?

X

To  add <script> tag in header, copy below custom code in your child theme functions.php file or parent theme functions.php file.

if ( ! function_exists( 'litho_child_header_custom_script' ) ) {
	function litho_child_header_custom_script() {
		?>
		<script src="https://example.script.js"></script>
		<?php
	}
}
add_action( 'wp_head', 'litho_child_header_custom_script' );

To add <script> tag in footer, copy below custom code in your child theme functions.php file or parent theme functions.php file.

if ( ! function_exists( 'litho_child_footer_custom_script' ) ) {
	function litho_child_footer_custom_script() {
		?>
		<script src="https://example.script.js"></script>
		<?php
	}
}
add_action( 'wp_footer', 'litho_child_footer_custom_script' );

Note : We recommend this code customization with a child theme to prevent your customization code when parent theme updates.

To add code in <script> tag, you do not need to write any custom code. For that you just need to use additional JS functionality. Click here to know more.

SCROLL UP