My tracking software requires me to place a script in ONLY the home/index of my site, however, since WP is template based, the script will appear on every page; I am unsure how to accomplish this.
-Scott
My tracking software requires me to place a script in ONLY the home/index of my site, however, since WP is template based, the script will appear on every page; I am unsure how to accomplish this.
-Scott
<?php if(is_home() [ do stuff] ;?>
pardon my ignorance...do I place the script then inside the php call?
Such as...<?php if(is_home() <script>do stuff</script> ;?>
Or do I need an ending tag?
-Scott
<?php if(is_home()) { ?>
CODE HERE..
<?php } ?>Thank you...Would I then place this in the first line of my main index or page template?
-Scott
Wherever your script needs to go (putting the PHP aside for a moment)..
Your script still goes where it needs to, most likely in between <head> and </head> if it's <script> kinda code.....
No different to how you'd do it in a normal HTML page, the only difference here is it's wrapped in the necessary PHP to conditionalise when the code is printed into the page..
Got it, thank you!
Actually, what if I wanted the script to reference a page other than the site's Home page?
I have a main site and another separate review site that I would like to combine. The review site, though it would become just a page on the main site, it will still have its own domain through redirection...how would I reference the script for only that page?
-Scott
This topic has been closed to new replies.