WordPress.org

Support

Support » How-To and Troubleshooting » Which template to edit to get code on every page?

Which template to edit to get code on every page?

  • Hi,

    I want to have a code snippet included on every linkable page of the blog. (This is so that my affiliates can link to any page and have the affiliate cookie set for them.)

    Which template should I insert the code in so that it will be on every page? (It’s invisible, so appearance is not an issue.)

    Secondary question: should I be using the php code snippet rather than javascript – is every page written in php?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Every template file is written in PHP.
    You should place your code in header.php or footer.php – they are present in every webpage displayed.
    See a visual anatomy how the template files build up a theme.

    If your theme has a header.php, I’d look at using it. Gives you the option of getting script above the body tag if that’s necessary.

    You can use javascript or php, doesn’t much matter — just treat it appropriately.

    Thanks – exactly what I needed. 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Which template to edit to get code on every page?’ is closed to new replies.
Skip to toolbar