• So I am trying to create a Theme which incorporates the Bootstrap Framework which I have managed to get working now and I have begun to start styling the theme.

    I have run in to an issue though tonight. I want the theme to have a Custom Background as default which is an Fixed, No-Repeat, Centered Image. I have tried many way through the functions.php file to get the Custom Background to load but to no avail..

    Here is the latest snipped of code :

    // Register Theme Features
    function custom_theme_features()  {
    
    	// Add theme support for Custom Background
    	$background_args = array(
    		'default-color'          => 'ffffff',
    		'default-image'          => 'http://www.djbroadhurst.co.uk/templates/ecommerce/wordpress/wp-content/themes/wpbootstrap/images/background.jpg',
    		'default-repeat'         => 'no-repeat',
    		'default-position-x'     => '',
    		'wp-head-callback'       => '',
    		'admin-head-callback'    => '',
    		'admin-preview-callback' => '',
    	);
    	add_theme_support( 'custom-background', $background_args );
    }
    
    // Hook into the 'after_setup_theme' action
    add_action( 'after_setup_theme', 'custom_theme_features' );

    If anyone can help me with this it would be wonderful. I am really struggling. I am not very good with php in the first place but managing to get my way around most the other sections.

    So once again I would like that image to be a Fixed / No-Repeat / Centered Background Image by Default when the person uses the theme but then still be able to customise it via the Customiser.

The topic ‘Setting Default Custom Background to My Theme’ is closed to new replies.