Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there code or a plugin that would make it possible to add default backgrounds, like you can with default headers in Twenty ten. Seems like the same frame work for backgrounds and headers.

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

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.)

share|improve this answer
    
I was not very excited about the new updates in 3.4 until now. - Thanks –  Gregg Franklin Apr 8 '12 at 22:45
add comment

If you can, add this snippet to your theme functions.php file, if you're using version under WP 3.4:

add_action( 'after_setup_theme', 'add_custom_background' );

Or if you have setup function for your theme, just add this call to it:

add_custom_background();

After you added it, new menu item "Background" will appear in your admin panel. At this page you can select custom background image or set background color:

custom background menu page

share|improve this answer
    
It seems that the add_custom_background() function is deprecated –  Lea Cohen Apr 19 '12 at 5:35
    
@LeaCohen It will be deprecated in WP 3.4, but it is not in previous versions! As WP 3.4 is not released yet I can consider add_custom_background as appropriate function for adding custom background facilities. –  Eugene Manuilov Apr 19 '12 at 6:08
add comment

Your Answer

 
discard

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.