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'm want to set a featured image for the archive templates of my theme. To my knowledge, there is not a way to do so in the WordPress Admin (like Pages and Posts).

I was thinking about writing a function that filters through the currently uploaded featured images and matches the template to the file name. Might be a bit complex.

I also know there are theme options. But this seems like a lot to manage.

How would you recommend doing this that facilitates Featured Image administration (Theme -> Header) and ease of maintenance...

share|improve this question
    
Just to clarify: are you trying to associate an image with an archive.php template/page of results? –  Ben Sep 21 '12 at 0:21
    
Yes, in a nutshell I'm trying to associate featured images with archive templates. –  Jason McCreary Sep 21 '12 at 2:47
    
I don't really get it. Do you want to set a header image for the archive template? If so, it would be as simple as if( is_archive() ) {..your image..}. If you want to change it from the backend, then you indeed need to create a options page for it. (Maybe there are plugins to do this, idk) –  xsonic Sep 21 '12 at 12:36
add comment

3 Answers

There are lots of archives in WordPress. Tag archives, date archives, category archives, term archives, author archives. Which archive do you mean?

You could start by trying the Taxonomy Images plugin http://wordpress.org/extend/plugins/taxonomy-images/

share|improve this answer
add comment

you could do this via css by defining an header image region in your archive.php and setting a background image in your style.css

or you could use the plugin dynamic headers http://wordpress.org/extend/plugins/dynamic-headers/ (works great even though it hasn't been updated since 2010)

share|improve this answer
add comment

Coming in quite late on this, but I believe this plugin addresses the original question: http://wordpress.org/plugins/categories-images/

It allows an admin to select a 'featured image' for a particular category / tag / taxonomy on the taxonomy edit panel. Then it can be used in a theme's archive.php (for example) by echoing z_taxonomy_image_url();.

If you'd rather roll your own, maybe check out the code in that plugin for a starting point.

share|improve this answer
add comment

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.