WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to extend the Custom Header class to include an animation feature for the header graphics. Essentially, I'd like to add another possible value for the radio button for randomization. The existing code reads:

if ( 1 < count( $headers ) ) {
        echo '<div class="random-header">';
        echo '<label><input name="default-header" type="radio" value="random-' . $type . '-image"' . checked( is_random_header_image( $type ), true, false ) . ' />';
        echo __( '<strong>Random:</strong> Show a different image on each page.' );
        echo '</label>';
        echo '</div>';

I would like to do something like this so you can toggle between random and animated. Default output would look something like this:

<div class="behavior-header">
<div class="default-header">
<label><input name="behavior-header" type="radio" value="none" checked />
<strong>None:</strong> No randomization or animation.</label>
<div class="random-header">
<label><input name="behavior-header" type="radio" value="random" />
<strong>Random:</strong> Show a different image on each page load.</label>
<div class="animate-header">
<label><input name="behavior-header" type="radio" value="animate" />
<strong>Animate:</strong> Display headers as slideshow.</label>

I have had no luck hooking into the custom_header_options (it just places any code into the end of the page, which does not allow for an either/or selection of none/random/animation). Anyone had any experience with extending the custom header class? Is there a simpler way to do this without extending the class?

I'm all ears :)

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.