Custom background is a theme feature in WordPress that allows customizing the background color and image.
Most free or premium themes comes with Custom background support. This allows you to add the background image easily. If your theme not supports, you can also enable Custom background support by modifying the function.php file.
If Custom background support enables in a theme, you can directly upload your own background image or can add the background color.
How to add Background Image:
Step 1: Login into your WordPress dashboard and go to Appearance > Background.
Step 2: Now you’ll be redirected to theme customizer and click on the background image.
Step 3: Click on select image option to continue. Now you’ll be redirected to media uploader where you can upload a new image or can select previously uploaded image.
Step 4: After selecting or uploading the image, click on choose image. Now you’ll be redirected to image preview option in theme customizer.
Step 5: Here you can change the image options. Below the background image, under preset option, you can choose how you want to display the background image from available options default, fill screen, fit screen, repeat and custom.
You can also change the image position by clicking on arrows. The image will align as per given instructions.
Click on publish button. Now you successfully added the background image to your website.
If your theme not supports Custom background feature, you can enable by modifying the function.php file. Let’s check how to enable Custom background feature support to a WordPress theme.
How to Enable Custom Background Support to a WordPress Theme?
To add Custom Background Support to a WordPress Theme, Login into your WordPress dashboard and go to Appearance > editor. Now click on function.php file and add below code and save the file.
add_theme_support( ‘custom-background’ );
Now, Custom Background Support enabled to your WordPress Theme. Go to appearance. You’ll find the background option to customize the theme using above step by step guide.
If you don’t want to preset the background image and want to add default background argument, you can add below default background argument code in your function.php file.
$defaults = array( 'default-color' => '', 'default-image' => '/images/background.jpg', 'default-repeat' => 'repeat', 'default-position-x' => 'left', 'default-position-y' => 'top', 'default-size' => 'auto', 'default-attachment' => 'scroll', 'wp-head-callback' => '_custom_background_cb', 'admin-head-callback' => '', 'admin-preview-callback' => '' ); add_theme_support( 'custom-background', $defaults );
Don’t forget to change the default image location to add your own image.
I hope this article helped you to know about Custom Background. Please share this article on Facebook, Google + and Twitter.