Add script tag

If I need to add to a single page.

Could this added to a content area on the page (if it is only to fire on a single page?)

I’ve attached the specific scripts to this post.

Hi @wbgTHEMECO,

Thank you for reaching out to us. To add a script on a specific page, first find it’s page ID ( to find out page / post ID please see https://theme.co/apex/forum/t/setup-how-to-locate-post-ids/59 ) and then add the following code in the child theme’s functions.php file:

function add_script() {
		if ( is_page( 712 ) ) {
  			?>
				<script>alert('123')</script>
			<?php
		}
}
add_action('wp_footer', 'add_script');

Whereas 712 is the page ID in the above code, replace it with your page ID and the <script>alert('123')</script> with your script.

Don’t forget to clear all caches including your browser’s cache after adding the code. Let us know how this goes!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.