Tutorial – How To Change WordPress Background Image?

Tutorial – 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 I will explain how to enable and use WordPress Background Image feature.

Now you don’t have to move to any other email marketing service because WordPress Subscription Plugin can help you to create and send powerful newsletters to your customer’s email addresses.

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 );
/*End*/

Note that I 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’);.

Check this related tutorial here – Tutorial – How To Change WordPress Header Image?

2. Show WordPress Background In The Site

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

<body <?php body_class(); ?>>

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 dashboard. Then
Under the heading Background Image click Select Image.

Next, 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’. Click Select Color button to select the background color of your choice and finally click Save & Publish button.

If you have a requirement for a specific post, then you can fulfill it by creatingWordPress Custom Post Type.

Share this article -

yogihosting

ABOUT THE AUTHOR

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