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; }
Output:
Thanks!
Related Posts:
- Why, when it comes to custom background and image, does ‘The first value registered’ win?
- Why doesn’t WP_Image_Editor save images using the Filesystem API?
- Is there a plugin to make attaching images easier?
- Managing Images for a WordPress Blog: Picasa or Flickr?
- FireFox Inspector :: find CSS file related to
- Automatically wrap post image in div
- Custom image size not selectable in uploader
- Retrieving and Storing Images Linked from Other Domains on Local Server?
- Customizer image control default value showing in customizer but not on frontend
- Importing media medium setting image gallery / image attachments
- Extract & Display the REAL first image attached to a post – extend the_post_thumbnail()
- Add filename to attachment page url
- How To Add buttons to the toolbar which appears in TinyMce when you click over images
- Image Editor does not affect custom sizes!
- How to display post title & excerpt when mouse hovers on an image?
- Automatically add image caption with values from a post parent field?
- Is there a way to dynamically get to your uploads folder?
- Using Fullscreenr with a wordpress blog – weird bug
- Get Image from Media Library with the Title
- Get Custom Logo Alt Text
- Using custom image resizing script in a page
- Best way to allow overwriting images shipped with the plugin?
- NextGEN Gallery – open all images on page in fancybox [closed]
- Featured Image If Else Condition
- If custom image header does not exist display text header
- Is there a possiblity to replace profile image gravatar with custom user images
- Menu not appearing in custom theme
- Custom theme – how to link the image without posting it
- Trying to set specific image dimensions and crop with ACF
- Customizing the gallery of the post correctly
- Personalized Gallery what are my options?
- adding fade on mouseover to images
- Lightbox not showing image caption
- WordPress 5: including larger thumbnail image sizes in srcset than I have set
- POST 429 Error when trying to place more than 20 images into post at once
- How to add the option to choose between sizes for featured image within post editor?
- Creating custom setting in add media popup
- Upload image without resizing but insert in post with resizing
- Bio comes up when the visitor clicks on a picture
- Adding images to anchors in the list created and fetched with wp_nav_menu
- Change default “Apply Changes To” radio option when editing images
- WP_Customize_Image_Control and selecting from library?
- featured images – custom links
- Get a different size of Image thumbnail while working with custom metabox
- Custom image sizes ignored in WP 3.5
- Edit image alignment in WordPress twentysixteen child theme on attachment page [closed]
- Set custom banner image size with wp_customize
- Post interior margin in twenty eleven theme
- How to search for replacement titles and contents, excluding image URLs
- Custom Search on media files PDF images pages posts
- Can we use one WordPress installation for multiple databases, domains and content directories
- When adding a custom REST endpoint, where do you put the endpoint function, and where do you put the function registration call?
- WordPress objects class reference
- How do you add pages on a staging server, and then move them over to production
- Any Hook Called When Post Becomes Published?
- Theme Twenty Fifteen: Customize Color Scheme Customizer
- How to handle security on a wordpress site? [closed]
- Is it possible to set default values for custom fields in a custom post type while my plugin is being activated?
- how to replace embedded “full” sized images within a post with the “large” ones
- Reinstall WordPress Without Losing Data
- Paginate Author’s Post List on Custom Author Page (ANOTHER THEORY)
- WP Northwind for Theme Development?
- How to check if site is created by wordpress? [duplicate]
- Enabling Additional CSS / custom-css
- How to Call a static page in WordPress
- Add google org chart to wordpress page
- Create custom dashboard for Multisite admins
- Highlight comments of all the site authors
- Set Title from Custom Template
- For a specific theme, how do I build a list of all the possible theme modification names?
- show random image in loop if image is not set
- wpdb custom tables without plugin
- Add a searchbox to the body of a page
- How to put a site offline, including images?
- How to add css option to Header Image customizer?
- How to print Array values of custom Fields Meta?
- Customizer JS API get value of customizer field
- Disable save as image on smartphones using all browsers ( chrome, firefox, ie, cm, opera )
- Hide content and functions from specific user roles
- Translating (WooCommerce) placeholder text
- Woocommerce custom archive page custom content and shortcode
- Page flickers in customization mode
- We are facing this error in header unable to understand the issue
- When is the wp-settings-[time] cookie generated?
- Get All Results From Other Users That Share The Same Custom User Meta As Current User
- How can I setup a development environment which auto refresh page when code have changed [closed]
- Trouble with custom login page
- I want to use a product thumbnail completely different than the product image
- How can I edit the WordPress menu link to allow fb: instead of http
- Fixed bottom menu on mobile doesn’t work on search included in Child Theme of Storefront
- admin aoolbar add_node() and pulling in my post slug
- duplicate featured image functionality in custom meta box
- Custom Form Input not saving to Database
- How to create 2 preview button in a post?
- Move text from the side of image to below image [closed]
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- Custom terms in custom category taxonomy
- Customize TinyMCE Buttons
- Setting Custom WordPress “Posts page” AS “Front page”
- Instead of Custom CSS Theme CSS is loading