Add default Backgrounds

There’s no default way to do that yet, though there is a Trac ticket. I found this (untested) that may work for you: http://www.devblog.fr/2011/05/16/plusieurs-fonds-personnalises-wordpress-add_custom_background/

It’s also worth noting the 3.4’s new way of defining a default background (still just one, though).

Edit

Here’s the code:

<?php
function wpse48332_setup_theme() {
    // Add support for custom backgrounds
    add_theme_support( 'custom-background', array(
        // Background color default
        'default-color' => '000',
        // Background image default
        'default-image' => get_template_directory_uri() . '/images/background.jpg'
    ) );
}
add_action( 'after_setup_theme', 'wpse48332_setup_theme' );
?>

(Note that you can also define front end, admin, and preview style callbacks, as well.)

Leave a Comment