How to add custom background in wordpress theme

Custom Backgrounds is a theme feature that provides for customization of the background color and image.
Theme developer needs 2 steps to implement it.

  • Enable Custom Background – add_theme_support()
  • Display Custom Background – wp_head() and body_class()
functions.php

add_theme_support( 'custom-background' );
header.php

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

Leave a Reply