1

I have a very simple theme to which I need to add custom-background support.

When I go into appearance -> customize, I am able to select a background image.

However, the background of the site never actually changes, and I can see that the output html contains

<body class="home blog logged-in admin-bar no-customize-support custom-background">

But there are no <style> tags to be seen.

Does anyone have any suggestions as to what may be going wrong?

header.php

<html>
<head>
    <title>Tutorial theme</title>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet">
</head>
<body <?php body_class(''); ?>>
    <div id="wrapper">
        <div id="header">
        <h1>HEADER</h1>
    </div>

functions.php

<?php
    $defaults = array(
        'default-image' => '',
        'default-preset' => 'default',
        'default-position-x' => 'left',
        'default-position-y' => 'top',
        'default-size' => 'auto',
        'default-repeat' => 'repeat',
        'default-attachment' => 'scroll',
        'default-color' => '',
        'wp-head-callback' => '_custom_background_cb',
        'admin-head-callback' => '',
        'admin-preview-callback' => '',
    );
    add_theme_support('custom-background', $defaults );
?>

I also tried simply adding add_theme_support('custom-background'); but no luck.

I am using version 4.7.5

  • Could you please provide the theme's name? – Frank P. Walentynowicz May 27 '17 at 0:34
  • @FrankP.Walentynowicz tutorial_theme – Bassie May 27 '17 at 0:51
  • no-customize-support body class suggests that you have javascript disabled in your browser. Enable it. – Frank P. Walentynowicz May 27 '17 at 2:09
  • Also, I cannot see a <?php wp_head(); ?> in the header.php file. Even if its just a simple theme you maybe need this as plugins for example rely on this. – LWS-Mo May 29 '17 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.