• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How to set a default background

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to set a default background

This topic is: not resolved

Tagged: background, default

  • This topic has 2 replies, 2 voices, and was last updated 11 years, 11 months ago by andym119.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • March 1, 2014 at 1:12 pm #92965
    andym119
    Member

    I run a multisite and I would like to set a default background for each theme.

    If I set the default background in the css, users cant't overwrite it in admin > appearance > background

    Is there a code snippet for adding a default background or background-image in my functions.php child themes.

    Any help would be much appreciated, thanks

    March 2, 2014 at 10:34 pm #93133
    Davinder Singh Kainth
    Member

    Have you checked this - http://wordpress.org/support/topic/set-default-background-image-repeat-in-multisite-child-theme and http://wordpress.org/support/topic/css-background-image-in-multisite-not-working


    Sunshine PRO genesis theme
    Need Genesis help? Davinder @ iGuiding Media | My Blog | Fresh Genesis Themes

    March 4, 2014 at 9:05 am #93379
    andym119
    Member

    Hi Davinder, thanks for the reply.

    Yes I have tried that as well as things like:

    
    $defaults = array(
    	'default-color'          => '000000',
    	'default-image'          => '',
    	'default-repeat'         => '',
    	'default-position-x'     => '',
    	'wp-head-callback'       => '',
    	'admin-head-callback'    => '',
    	'admin-preview-callback' => ''
    );
    add_theme_support( 'custom-background', $defaults );
    
    
    $args = array(
    	'default-color' => '000000',
    	'default-image' => get_template_directory_uri() . '/images/background.jpg',
    );
    add_theme_support( 'custom-background', $args );
    

    But that only sets the background ready in appearance > background, users have to click save for it to take affect on the front end.

    This works on the front end by default, by using css in the functions.php but again, users can't overwrite it in appearance > background:

    
    add_custom_background('set_theme_background');
    function set_theme_background() {
    	echo "<style type='text/css'>";	 
    		echo "body { background-color: #000000;}";
    	echo "</style>";
    }

    Is there a way of putting a conditional to the above code so it applies the above only if there is no background set in appearance > background.

    Thanks in advance

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble