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
- Users with custom roles not showing in post author select box
- How to remove comment section from page only , not from posts pages?
- Archive Listings Filtered by Date Values in a Custom Field/Post Meta?
- deleted users still show in count?
- How to deal with multiple select options using register_setting() theme options
- Any amazing WordPress MultiSite sites? [closed]
- Add URL field to the link post format
- How to fix broken upgrade to 3.1
- Can I create front-end editable user profile pages with WordPress? How do I do it?
- Add a page that appears in the backend admin that lists files to download? WP 3.3
- Multiple Queries and Excluding Repeating Posts?
- Add new Control to Customizer to modify Headings (h1, h2, h3…) Color
- How can I & how do I change text displayed in comment via child theme
- get_option issues
- How to change URL Custom Page?
- Custom column sorting in WordPress admin post table
- Comments not nesed with custom template
- How to get multiple Action Hooks in an Array
- What values can we use in `formattingControls` parameter in RichText component
- What will happen to the additional CSS when the theme is updated?
- Multiple Blogs on one site. Best Practise
- Limiting allowed html elements/strip harmful scripts from editor
- Customizing default Mediaelement player
- Filter my home page posts by category or by tag
- Custom members area (interface/design) in WordPress, is it possible and how?
- Override database config for WordPress multiblog
- Password protected photo galleries
- How do I fix unexpected redirection of visitors after enabling multisite on WP3?
- Add more then one site logo – custom-logo theme support
- How to get “string” away – replaced with “nothing” [closed]
- Can not sanitize select control in customize api
- Google font doesn’t show in theme option
- Add a InfoBox in the media upload window
- Multiple RSS feeds scroller in one sidebar
- Steps for custom data retrieval
- Remove add news page and posts from menu
- Custom Status of Custom Post type need to EXCLUDE from Taxonomy pages
- redirect post id to post full url
- Silo Structure; Will links from home page to a Sub-category or Post undermine silo seo advantage? [closed]
- Is there a way to use LaTeX formatting for WordPress?
- Manage multiple domains from one backend
- order event posts by multiple custom fields
- Image LazyLoad plugin not loading jQuery dependancies with wp_enqueue_script in WP 3.3.1
- Background image no more visible in the preview
- I need to make the title of the page dynamic in my custom plugin
- Custom CSS working on home page but not on NEW created PAGE
- Looking for a way to align log in form fields with background image and scale responsively
- Customizing Additional CSS editor
- How To Fix the “Another Update is Currently in Progress” Error in WordPress
- Newbie question – which css file to edit
