WordPress.org

Ready to get started?Download WordPress

Forums

Adding a header line of copy that changes (4 posts)

  1. cgriffis
    Member
    Posted 2 years ago #

    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.

  2. stvwlf
    Member
    Posted 2 years ago #

    Your question is not specific enough for anyone to answer. What is the type of line you are adding into the header?

  3. cgriffis
    Member
    Posted 2 years ago #

    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.

  4. stvwlf
    Member
    Posted 2 years ago #

    Hi

    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:
    http://wp.smashingmagazine.com/2010/04/29/extend-wordpress-with-custom-fields/

    http://voodoopress.com/a-brief-introduction-to-custom-fields/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.