How To Change WordPress Background Image

How To Change WordPress Background Image

All WordPress theme should support ‘Custom Background’ feature which allows theme users to set their own Background Image and Color. In this tutorial we will explain how to enable and use WordPress Background Image feature. Just follow the below 2 steps for enabling and making use of this feature in your WordPress theme.

1. Enable WordPress Custom Background

Enable it by adding the following code in your theme functions.php file.

 /*Custom background*/
    $args = array(
	'default-color' => '000000',
	'default-image' => get_template_directory_uri().'/Images/background.jpg',
	add_theme_support( 'custom-background', $args );

Note that we have provided the default color and image to our theme from the $args argument. You can simple remove the argument (if you don’t want to provide default values) and just add – add_theme_support( ‘custom-background’);

2. Show WordPress Background In The Site

Update your theme HTML body tag to provide body_class like this –


It will give the body element different CSS classes including ‘custom-background’ class through which the custom background image and color are applied.

Changing WordPress Background Image and Color

To change the Background Image go to ‘Appearance > Background’ in the WordPress CMS. Under heading ‘Background Image’ click ‘Select Image’. Here select the image or upload a new image then click ‘Save & Publish’ button to save the background image.

Changing Custom Background Color in WordPress

Changing Custom Background Color in WordPress

To change the ‘Background Color’ in the same place under the heading ‘Colors’ you will see ‘Background Color’, here click ‘Select Color’ button to select the background color of your choice and finally click ‘Save & Publish’ button.

Share this article -



This article has been written by the Technical Staff of YogiHosting. Check out other articles on "WordPress, SEO, jQuery, HTML" and more.