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 have a client site that requires a random background image. I figured that custom-background would have something similar to custom-header for randomizing which image is selected, but alas it does not seem to be the case.

Does anyone have experience doing this, or know what direction would be best to extend custom-background? Or would the better approach be to ignore custom-background and create my own background theme support (I severely frown upon this method, but 'the easy route' is always there).

share|improve this question
up vote 1 down vote accepted

I created a theme like this sometime ago using backstretch script http://srobbin.com/jquery-plugins/backstretch/ very light and easy to set.

But note that if you want to allow the user/client to change/order the images you will need to create a theme panel/options.

share|improve this answer
Thanks for the link! So you did not extend the built-in background in any way, you simply made your own? – Eric Holmes Sep 20 '12 at 19:07
No, because this script can adjust the image in different display sizes and offer transitions effects (there are some other scripts alike with slider controls, thumbs etc). WP feature is very basic. The client wanted some specific images for home page and then in posts/pages be able to inform an url to a image (in Media Library or else). I created a custom metabox and then in single pages/post I get the image and use in this script. You can create a very specific area in posts/pages allowing set the image order etc. – Diana Sep 23 '12 at 3:40

I'm using child theme with twentythirteen parent. Made a directory with images in my child theme. But first removing default 2013 theme headers.

/* Add custom headers from my child theme */

add_action( 'after_setup_theme', 'childtheme_setup' );

if ( ! function_exists( 'childtheme_setup' ) ):
function childtheme_setup() {   

    /* Remove Default Headers */
    function dr_remove_twenty_thirteen_headers(){
        unregister_default_headers( array(
    add_action( 'after_setup_theme', 'dr_remove_twenty_thirteen_headers', 11 );

    // Add our headers 
    register_default_headers( array(
        'header1' => array(
            'url'           => get_stylesheet_directory_uri() . '/images/headers/target_head2.jpg',
            //'thumbnail_url' => '%s/images/headers/circle-thumbnail.png',
            'description'   => _x( 'header1', 'header image description', 'twentythirteen' )
        'header2' => array(
            'url'           => get_stylesheet_directory_uri() . '/images/headers/target_head1.jpg',
            //'thumbnail_url' => '%s/images/headers/diamond-thumbnail.png',
            'description'   => _x( 'header2', 'header image description', 'twentythirteen' )
        'header3' => array(
            'url'           => get_stylesheet_directory_uri() . '/images/headers/target_head0.jpg',
            //'thumbnail_url' => '%s/images/headers/star-thumbnail.png',
            'description'   => _x( 'header3', 'header image description', 'twentythirteen' )

    ) );

This works on my wp 3.6. You may add more images. I have 9 :)

share|improve this answer
That would work great for randomized mastheads, but we were going for a full-screen background. We figured it out a while back, but thanks :) – Eric Holmes Aug 19 '13 at 12:55

Your Answer


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.