WordPress.org

Ready to get started?Download WordPress

Forums

Which template to edit to get code on every page? (4 posts)

  1. hilaryjb
    Member
    Posted 8 years ago #

    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?

  2. moshu
    Member
    Posted 8 years ago #

    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.

  3. Chris_K
    Member
    Posted 8 years ago #

    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.

  4. hilaryjb
    Member
    Posted 8 years ago #

    Thanks - exactly what I needed. :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags