Jump to content
Sign in to follow this  
kdboost

I need to add Google code to just my contact page?

Recommended Posts

kdboost

I normally place scripts in the header or foot files. This time I need specific script just on my contact page. How do I do this without having it show up on every page?

Share this post


Link to post
Share on other sites
Sourena
What theme do you use?

alefba.us

Web Development & Design for Right-to-Left languages

Share this post


Link to post
Share on other sites
kastelic
Find the ID for your contact page and wrap your code in this: [code] if ( is_page(123) ) { //code only for page id 123 goes here. Change for your site. } [/code] You can't put php in the Headerscripts or Footerscripts boxes in the pagelines admin, only in the functions.php file or a php file.

Share this post


Link to post
Share on other sites
kdboost
Great, just a little more information. My permalinks are set to names of pages. http://nehair.com/contact/. This is my permalink. Where do I find this page to wrap the code? And could you be more specific on the use of "wrap" to you mean like a body tag put the if at the top and the end bracket on the bottom of the entire page? thank you. i do understand your comment in general. ready and waiting

Share this post


Link to post
Share on other sites
Kate
It depends on which route you go. For instance, if you choose to put the code in functions.php, you would need to use a hook. (We have information in the docs on hooks, if you need assistance getting started.) Some of the hooks for the header are listed right in the Settings panel of your theme. If you go to Template Setup, and choose "Header", there's a pulldown that says "Advanced Setup". You can find the hooks there. Then, you would use the appropriate hook to add your code in. And, using the ID is still fine, even if you have permalinks setup.

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  

×