Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to add this function:

add_theme_support( 'custom-header' );

I would like this to somehow combine with multiple headers. I saw some code that was PHP that checked which template was loaded then add the image (header) that was defined in the code.

This is not totally optional since I want my theme to allow the user of the theme to change the header for his "buyers" template, the "sellers" template, so forth. Is there any way to make the 'custom header' page allow several custom headers that are called on different templates?

share|improve this question
    
It is unclear what you mean by 'templates', do you mean page templates, post loop, archives, the whole site? –  Wyck Dec 16 '12 at 17:42

1 Answer 1

What you want to achieve is posible but not with WordPress custom-header feature because it's you can use multiple images in random sequence.

If you mean 'different page templates' you can simply hard code your images links in your templates, but this is not good solution.

Another solution is to write function which will check the name of page template and change header image.

If you need that functionality for normal users you need to create a new settings page for your theme. It should save to WP options information about template name and image for it.

share|improve this answer
    
I have a php code that checks the WP template name and adds the image (hard coded from the header) to the page. I need the user of the template to be able to set the header that is hard coded in the php without knowing php. The custom header function is nice because of it's back office application. I need to add a back office header upload page for each template... Anyone? –  user1837671 Dec 16 '12 at 17:05
    
I improve answer for you, yes you need make a new page with settings for every page template, but it is not hard to achieve. –  Maciej Płusa Dec 16 '12 at 17:16
    
Thank you for your continued help. Is there someone that can give me an example of such an effort. I am not the most knowledgeable person for doing this. Please assist. What code would accomplish this... –  user1837671 Dec 16 '12 at 17:22
    
If you are theme developer you should achive this with codex pages, idea behind that I just wrote in answer. On option pages you seve your settings to WP options and in header.php you read it and set the right link for header image. –  Maciej Płusa Dec 16 '12 at 17:27
    
Please do not suggest theme developers to hardcore anything like this, it's what makes bad theme developers..bad. –  Wyck Dec 16 '12 at 17:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.