Add Support For Custom Background Image

Some themes already include support for adding a custom background image or background color.

custom background

If your theme doesn’t include this page, you can add it simply by adding this code in your child themes functions.php file.

The code assumes you have uploaded a default image named bg.png to your child themes images folder.

Here’s the basic code without any parameters:

Related Posts

2 responses to “Add Support For Custom Background Image”

  1. […] you've added a custom background image using the Custom Background page under your Appearance menu it will display on every page of your […]

  2. I added this in my Magazine pro theme functions.php
    [code]
    add_theme_support( ‘custom-background’ );
    [/code]
    and background option came but now when I upload image via this option ,it does not stretch ,I am using 960px x 760px image ,I don’t want to do this via this option as it is not changeable through background under appearance ,any help would be appreciated
    [code]
    add_theme_support( ‘custom-background’, array(
    ‘default-image’ => get_stylesheet_directory_uri() . ‘/images/bg.png’,
    ‘default-color’ => ‘f3f3f3’,
    ) );
    [/code]

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.