Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8350623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:22:20+00:00 2026-06-09T08:22:20+00:00

I have a WordPress custom theme that I want to have various alternative background

  • 0

I have a WordPress custom theme that I want to have various alternative background colours based on a dropdown menu. I was going to use alternative stylesheets just to change the background colour of my theme, but it just seems counter-productive. I was also going to use classes to change the background colour, just I’m not too sure which is the best way to go about changing the background colour based on a selected colour.

Example

If I choose “blue” on the dropdown menu that I’ve created, it will change my website’s background to blue. I’ve got all the css in place. I’m now just wondering what the best way would be to go about doing this. I have classes in place for Internet Explorer so I’m not sure how to go about using classes if I do decide to use classes. I guess I could use jQuery?

Sorry for the abrupt question, but I’m not quite sure which would be the most efficient way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:22:21+00:00Added an answer on June 9, 2026 at 8:22 am

    Here’s a way of achieving this in jQuery. You could choose to add a class to the body instead if you like, but remember to remove other classes first.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
      <meta http-equiv="content-type" content="text/html; charset=windows-1250">
      <meta name="generator" content="PSPad editor, www.pspad.com">
      <title></title>
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
      <script type="text/javascript">
        $(document).ready(function(){
          $('#colour').change(function(){
            $('body').css('background',$(this).val());
          });
        });
      </script>
      </head>
      <body>
    
        <select id="colour">
          <option value="">Please Select
          <option value="#00F">Blue</option>
          <option value="#F00">Red</option>
          <option value="#0F0">Green</option>
        </select>
    
      </body>
    </html>
    

    or via classes:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
      <meta http-equiv="content-type" content="text/html; charset=windows-1250">
      <meta name="generator" content="PSPad editor, www.pspad.com">
      <title></title>
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
      <script type="text/javascript">
        $(document).ready(function(){
          $('#colour').change(function(){
            $('body').removeClass('blue red green').addClass($(this).val());
          });
        });
      </script>
      <style type="text/css">
        .blue { background: #00F; }
        .green { background: #0F0; }
        .red { background: #F00; }
      </style>
      </head>
      <body>
    
        <select id="colour">
          <option value="">Please Select
          <option value="blue">Blue</option>
          <option value="red">Red</option>
          <option value="green">Green</option>
        </select>
    
      </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am including a custom menu in a wordpress theme - I want it
I am using the WordPress theme Studio8 and I have create some custom forms
I wanted to use the custom field for wordpress to have a different header
I have a custom background image on one of my Wordpress login pages. After
I have a wordpress theme that has a build in shortcode for creating an
I want to use AMember to have people purchase WordPress plugins and themes. However,
I want to create a custom page for my WordPress blog that will execute
I am building a custom wordpress theme and have a slideshow on the front
Hi I am creating a wordpress custom page theme, I have included the code.
I'm currently studying WordPress and want to create a custom Post Type and have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.