How to remove custom background?

Inside the theme folder there should be a file called functions.php. Search for the line add_theme_support( ‘custom-background’ ); and replace it with #add_theme_support( ‘custom-background’ ); which is simply ‘deleting’ calling the function and thus the possibility to specify a custom background in the admin side.

Weekly background code not working

In this scenario, the tag that you want to call to execute your function is the wp_head(). Looking at the code you provides, you have the idea down, but I decided to rewrite it differently. In your child theme’s functions.php file, add the following: add_action( ‘wp_head’, ‘wpse_238911_weekly_background’ ); function wpse_238911_weekly_background() { $day = date( “l” … Read more

How to customize a divs background dynamically using Advanced Custom Fields Plugin?

You can apply a style to the header <div> (or the <header> element), and then add an inline style using wp_add_inline_style(). For example, let’s say you’ve got something like this in your header.php file: <header id=”masthead” class=”site-header” role=”banner”> (Cribbed from the Twenty Twelve theme.) Let’s say you’ve set up the neighborhood’s color as post meta-information … Read more

Is this possible to attach the background image to a div instead of body?

By default, WordPress uses the _custom_background_cb() function to create the style you show in your question. You can use a function of your own by adding it to the add_theme_support() in your theme. add_theme_support( ‘custom-background’, array( ‘wp-head-callback’ => ‘wpse_113346_custom_background_cb’ ) ); Initially, you can use the guts of the _custom_background_cb() function for your own function: … Read more

Get background color for Live Preview with Theme Customization API?

If you’re using the built in custom background stuff, it’s already all using postMessage. So, just bind a function to the background_color message and adjust your border color accordingly. Something like this, I expect: wp.customize(‘background_color’,function( value ) { value.bind(function(to) { jQuery(‘whatever’).css(‘color’, to ? to : ” ); }); }); Obviously, change the jQuery call in … Read more

Custom background for the index page only?

You can check in your callback function if you are an the front page. Sample code for the theme’s functions.php: add_action( ‘after_setup_theme’, ‘wpse_67480_theme_setup’ ); function wpse_67480_theme_setup() { $bg_options = array ( ‘wp-head-callback’ => ‘wpse_67480_background_frontend’, ‘default-color’ => ‘f0f0f0’, ‘default-image’ => ”, ); add_theme_support( ‘custom-background’, $bg_options ); add_theme_support( ‘custom-header’, array ( ‘width’ => 960, ‘height’ => 200, … Read more