WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Themes» How to Enable Custom Background in WordPress 3.0 Themes

How to Enable Custom Background in WordPress 3.0 Themes

Last updated on March 13th, 2013 by Editorial Staff
28 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
How to Enable Custom Background in WordPress 3.0 Themes

WordPress 3.0 introduces a new feature called custom backgrounds for WordPress themes. This feature will give the user an ability to add custom backgrounds to their site which will give their blogs/sites a unique touch. Even though this feature is added to the core, it will only be activated if your theme supports it. In this article, we will show you how you can enable Custom Background in WordPress themes for WordPress 3.0.

Note: This article is intermediate level article focused specially for theme designers.

Update: the code used in the video add_custom_background is depracated. Look at the code below in this article.

Video:

Text-tutorial

Simply open your functions.php file and add the following line:

add_theme_support('custom-background');

Then under appearance you should be able to see an option for Custom backgrounds.

Custom Background in WordPress 3.0

The default twenty ten theme for WordPress 3.0 already has this feature enabled in it.

28 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • How to Fix the Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

  • Revealed: Why Building an Email List is so Important Today (6 Reasons)

    Revealed: Why Building an Email List is so Important Today (6 Reasons)

  • Google Analytics in WordPress

    How to Install Google Analytics in WordPress for Beginners

  • How to Properly Move Your Blog from WordPress.com to WordPress.org

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

26 Comments

Leave a Reply
  1. bb says:
    May 15, 2014 at 9:20 pm

    Thank you Syed, this tweak just save me some thousand naira! Cheers.

    Reply
  2. Stepan Vich says:
    Oct 23, 2013 at 7:42 am

    Hi, Is there the possibility to add some field settings via add_settings_field function ??

    Reply
  3. Michael says:
    Mar 13, 2013 at 12:08 pm

    This has been depricated. Here’s the new code:

    add_theme_support(‘custom-background’);

    Reply
    • Editorial Staff says:
      Mar 13, 2013 at 2:31 pm

      Thanks Michael. Updated the article.

      Reply
  4. Editorial Staff says:
    Feb 9, 2012 at 9:12 am

    Very certain that you can use custom fields to change the background on each post / page if you want.

    Reply
  5. Abhimanyu says:
    Feb 22, 2011 at 1:28 am

    There seems to be a problem. Just as I select the image file and click upload, it refreshes the page with no result. The ‘color’ thing works. And, I have tried many browsers.

    Any help? Can we do it manually? As in, by some codes?

    Reply
    • Editorial Staff says:
      Feb 22, 2011 at 2:06 pm

      Do it manually via CSS codes.

      Reply
  6. The Raptor says:
    Feb 3, 2011 at 8:45 am

    Thank you for this. Implementing it wa actually much more simple than I initially thought

    Reply
  7. John says:
    Dec 6, 2010 at 6:28 am

    What is the default size for wordpress backgrounds? i.e. what size should images be for them to fit properly in the background.

    Reply
    • Editorial Staff says:
      Dec 6, 2010 at 8:57 am

      The best image is the one that can be repeated, so you keep the page load time small. WordPress will only show the background image that fits the screen resolution of the user.

      Reply
  8. chartinael says:
    Oct 28, 2010 at 5:48 pm

    My custom background section doesn’t have the display options. I installed 3.01 virgin.

    Reply
  9. aleksander says:
    Aug 24, 2010 at 8:00 am

    Same situation here:
    Fatal error: Call to undefined function add_custom_background() in /mnt/data/www/sinya/aleksander.hu/i.aleksander.hu/wp-content/themes/stylize/functions.php on line 34

    what to do?
    haven’t upgrade yet to 3.0.0

    Reply
    • Editorial Staff says:
      Aug 24, 2010 at 8:25 am

      You MUST upgrade to 3.0 before you add this.

      Reply
  10. Lane says:
    Jun 8, 2010 at 9:13 am

    Hey I did what you said but i got this message

    Fatal error: Call to undefined function add_custom_background() in /home/patina/ilovepatina.com/wordpress/wp-content/themes/default/functions.php on line 2

    And now it won’t let me sign in at all to even go into the admin.
    Any advice? I need help bad…

    Reply
    • Editorial Staff says:
      Jun 8, 2010 at 10:10 am

      Did you upgrade to WordPress 3.0?

      Reply
  11. Ed says:
    Jun 2, 2010 at 4:14 pm

    Hey… that was cool. After my first comment, I am taken to a different page with more information about your website and commenting… how did you make that happen? Plugin?
    I’d love to know more.

    Reply
    • Editorial Staff says:
      Jun 2, 2010 at 8:41 pm

      Its a plugin in our Recommended Plugins list. Go to our homepage and look there. :)

      Reply
  12. Ed says:
    Jun 2, 2010 at 4:12 pm

    It is important to note that for this to work within a theme, you must add the wp_head() after your theme stylesheet link in the theme header. This new function adds blocks with the added color/background from within the wp_head() section, and if you call your stylesheet after the wp_head(), your stylesheet will override the custom background function.

    I am torn, as I tend to call my stylesheet after the wp_head() call so that I can override styles added by plugins. May need to make a separate stylesheet for plugin overrides to be called later in the header.

    Reply
  13. Pete says:
    Apr 15, 2010 at 7:19 am

    Do you know how we do the custom header image as well?

    Reply
    • Editorial Staff says:
      Apr 15, 2010 at 8:38 am

      Hey Pete,

      Check out our newest article about Custom Header Image Panel in WordPress

      Reply
  14. gifer says:
    Apr 12, 2010 at 1:12 pm

    hey thanks,btw is there any demo of it ?

    Reply
    • Editorial Staff says:
      Apr 12, 2010 at 5:19 pm

      The new twenty-ten theme is the best demo example.

      Reply
  15. Pete says:
    Apr 12, 2010 at 3:37 am

    So how does WordPress know how to change the background? What if my current theme already has some background css attributes? Which one over-rides the other?

    Reply
    • Editorial Staff says:
      Apr 12, 2010 at 5:30 pm

      Your current theme would have to be made compatible with this feature. This is article is for theme designers who are creating themes and want to get WordPress 3.0 features in it. You would have to add the function for body class. If WordPress see that someone has updated the Custom Backgrounds page in the admin panel, then it will be prioritized. Otherwise the default background that you specify in the css file prevails.

      Reply
  16. Dustin Goerndt says:
    Apr 11, 2010 at 9:26 am

    Radical! I wonder, can these be done per post or page?

    Reply
    • Editorial Staff says:
      Apr 12, 2010 at 5:32 pm

      With the default function NO. For that you are better of using a plugin (several exist). The way this function works is it adds styling to the overall body class, so it will be the same for the entire site.

      Reply

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
SeedProd Logo
SeedProd
Create beautiful custom landing pages - Drag & drop builder. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2020 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2020)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2020)
    • SiteGround Reviews from 4196 Users & Our Experts (2020)
    • Bluehost Review from Real Users + Performance Stats (2020)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2020 – Step by Step Guide
Deals & Coupons (view all)
FancyThemes Logo
FancyThemes Coupon
Get 15% off on all FancyThemes when you use this exclusive coupon for WPBeginner users.
SiteGround
SiteGround Coupon
Get up to 63% off off SiteGround's WordPress hosting. Don't miss out!
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).
Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress CDN by MaxCDN | WordPress Security by Sucuri.