Support » Fixing WordPress » Adding a header line of copy that changes

  • I am trying to add a line of copy into the header that I can change to say something different for each page.

    Is there a php code that I could use to do this?

    If it is helpful I am also working with OptionTree. With this I could program in the fields I need to fill in for each page.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Your question is not specific enough for anyone to answer. What is the type of line you are adding into the header?

    It is not a difficult line, just copy. Like “the experience is everything.”

    But I was wanting to change it out on different page but leave it in the header.


    It wasn’t clear from your post if you were referring to the HTML <head> section about a meta tag, or to the WordPress visible header section. Now it is – you want something visible in the header.

    I’m not familiar with Option Tree. I looked at its writeup – it appears for adding fields on theme option pages. That’s not what you want if you want a different line of copy on each page. Theme options, more or less, are sitewide. You want something that is different on each page.

    That is basically what WordPress Custom Fields are for.

    Since you only want one field of information you could use the Custom Fields metabox that is already part of the Post and Pages edit screen.

    After entering the custom fields you then have to modify your theme to display them on each page. How you do varies from theme to theme.

    The basic process is, retrieve the custom field using the WordPress function get_post_meta() and then display the retrieved line in your header.php (or equivalent) theme file.

    If you’re not familiar with custom fields, here are two good articles:

    A Brief Introduction to Custom Fields

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding a header line of copy that changes’ is closed to new replies.