- How can I place featured images into the header, so each post has it's featured image within the main header?
- 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.
- 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?
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Your question is confusing but I'll try.
$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.
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.
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: https://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.