Jump to content
Sign in to follow this  
joie

What plugin to load script on Head tag for specific page

Recommended Posts

joie

Does anyone what plugin to use to load javascript to the head tag on specific page. My google map javascript should only be loaded in the contact page at tag, On other pages when loaded, it would show errors Currently the Header script box at platform pro apply the script to all pages Thank you, regards, joie

Share this post


Link to post
Share on other sites
joie

What method would you recommend on modifying header.php so that it wont get overriden by the next platform pro update ?

Share this post


Link to post
Share on other sites
Simon

Do not edit it period! Add a wordpress action to your platformbase functions file:

	add_action( 'wp_head', 'my_header_scripts' );
	function my_header_scripts() {
	
	if ( is_page( 'yourpage' ) ) {
	?>
	
	
	YOUR HTML HERE
	
	
	

Share this post


Link to post
Share on other sites
joie

thank you pross, small question, what is the 'yourpage' format, is it page id ? or permalink ? or full http URL ?

Share this post


Link to post
Share on other sites
joie

Found it can be done like below is_page( array(293,118) )

Share this post


Link to post
Share on other sites
Simon

Yes it can.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×