Background image not appearing

I'm trying to add a custom background on a child theme. In the child theme's functions.php, I add add_theme_support( 'custom-background'); and the background option appears under the "Appearance" menu as expected. I add the image that I want, save, and nothing happens. The image won't appear as the background. What am I doing wrong?

Using version 4.3.1.

This is all that's in my child theme's function.php"

?php

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

}

add_theme_support( 'custom-background');

Topic add-theme-support custom-background images customization Wordpress

Category Web


custom background can be used in below way:

  $defaults = array(
  'default-color'          => '',
  'default-image'          => '',
  'default-repeat'         => '',
  'default-position-x'     => '',
  'default-attachment'     => '',
  'wp-head-callback'       => '_custom_background_cb',
  'admin-head-callback'    => '',
  'admin-preview-callback' => ''
  );
 add_theme_support( 'custom-background', $defaults );

Example usage:

 $args = array(
  'default-color' => '000000',
  'default-image' => '%1$s/images/testback.jpg',
 );

add_theme_support( 'custom-background', $args );

Example output when you will view source:

 <style type="text/css" id="custom-background-css"> body.custom-background { background-color: #bdd96e; }

For details follow link:

Output:

enter image description here

Thanks!

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.