Works also with themes without header image support
-
Works right out of the box with themes that support custom header images. But I found that with a little tweak it also works fine with themes that don’t have header images. Just add something like this to the category template or template include:
<img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="" />
I am working on a magazine type site amd use a commercial magazine theme that has it’s own header setup (with dozens of variations). But it doesn’t have an option to just set a header image (duh). I added the code above to the right template part, and it worked right away. Now I have the default theme header, and for each category a separate “header image” between the actual header and the posts. So it functions as a custom taxonomy featured image. Great!
- The topic ‘Works also with themes without header image support’ is closed to new replies.