Forums

[resolved] Different header per page? (4 posts)

  1. erikreagan
    Member
    Posted 7 months ago #

    I would like to make it a part of my theme to where the header changes depending on the page that I am on a different image will appear in the header. I am fairly new to wordpress but I have a lot of xhtml/css experience and my php knowledge is moderate. I can find my way around a lot in PHP but I can't write it all off the top of my head....

    I am unsure of the best way to approach this (or if something like it exists). Should I try adding a field to the Edit Page page in admin that holds my image URL or is it something I can use the custom field for this? Will there be a problem doing it that way since the header isn't in the loop? The only way I can thing of doing it inside the loop and still change the header is to insert javascript that does a DOM element.style.background change or something.

    Thanks for and any all help! :)

  2. nickohrn
    Member
    Posted 7 months ago #

    You could try is_page('page_name') to test for the page and change the source of the image that way.

  3. erikreagan
    Member
    Posted 7 months ago #

    I thought of that earlier but I didn't want to have lines and lines of code because I will have 20+ of said header images.

    I just found a plugin called Get Custom Field Values that does exactly what I want. It allows me to read the custom field data and echo that anywhere outside the loop. I will probably venture to create a plugin that allows me to browse my media for the file and insert that way but for now this works great.

    :)

  4. capelyddol
    Member
    Posted 2 months ago #

    If you have the code for this I'd really appreciate it. I've been trying to do this for days and it has eluded me. I have two pages I wish to have different header images on, but I can't get it to work, any which way.

Reply

You must log in to post.

About this Topic

Tags

No tags yet.