WordPress Custom Header Image API

Eureka! Custom Header API Enlightenment

Wednesday, March 4th, 2009

For the longest time, I’ve been struggling with the WordPress Custom Header API. I wanted to use it in my next theme, but was getting some wierd behavior, and it was screwing up a snippet that I use in the header that renders the right heading tag for the right page, and the headerimg is an <h1> tag on the front page only.  The post titles on the front page are <h2>. I use <h1> tags for top level pages, single post pages, and <h2> tags for archives, category pages and the like.   I use the above code to make sure the semantics were right.

I wish they’d made it a bit more flexible. it would be nice to upload both a background to the header div AND replace the headerimg div lext wtih a logo. And leave the description part alone, electing to hide it separately.

I am sure that all this can and will be soon accomplished by a WordPress geek soon! Just don’t expect it to be me! :D

So, I elected to trash the idea of custom image header in the next theme. What I am going to start doing though, is opening both support forums and making videos of how to do these manually,

Here’s my code I couldn’t bear to part with: goes in header.php, replacing everything in the <headerimg> its ending </div> tag.

<?php if (is_front_page()) { ?>
<h1><a href=”<?php echo get_option(‘home’); ?>/” title=”<?php bloginfo(‘name’); ?>”><?php bloginfo(‘name’); ?></a></h1>

<?php } else { ?>
<a href=”<?php echo get_option(‘home’); ?>/” title=”<?php bloginfo(‘name’); ?>”><?php bloginfo(‘name’); ?></a>

<?php } ?>

So, production on the promised theme shall begin again soon!

Good morning, world!