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.
  1. How can I place featured images into the header, so each post has it's featured image within the main header?
  2. Also on category archive pages and the main news page, the featured images are being used in the traditional way, using the custom post image so is there a way around that too, where I can use the featured image for both posts and header.
  3. Maybe there is a way of having two custom thumbnail images and calling one up for the featured image and the other for the header?
share|improve this question
add comment

1 Answer

Your question is confusing but I'll try.

Item 1

The $post variable is set before the template loads. It is preset to the first post in the Loop by the main query, so on single post/pages it matches the post/page that you are on and you can use it in the header to display your thumbnail.

Item 2

This is the most confusing of your questions. I am not really sure what you want. Again, the $post variable is set before the template loads. You could use that to display the thumbnail from the first post in the results in the header of the page. You would be using "the featured image for both posts and header" but there are potentially multiple thumbnails on a category archive so I am not sure that is what your really want.

Item 3

By default, there is not way to do this, but it pretty easy to have multiple featured images by way of custom meta fields.

See also: http://wordpress.stackexchange.com/a/109468/21376 A synopsis of that link: Trusting $post out of Loop context is a bit dicey unless you really understand WordPress template rendering internals. Using a function called get_queried_object can help get more expected behavior.

share|improve this answer
    
Thanks for having a go at answering my question, if you have a look at the HTML5Boilerplate-Starkers-WordPress-Theme on github bit.ly/19akA4B it answers my problems and probably explains what I was on about. –  Nsokyi Aug 10 '13 at 17:55
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.