Forums

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

  1. erikreagan
    Member
    Posted 1 year 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 1 year 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 1 year 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 1 year 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.

  5. aledarbo
    Member
    Posted 9 months ago #

    Mandigo its a theme which allows differents headers per page. You can use it...or maybe you can copy the code and use it in your theme

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.