Chainging page background colour using wordpress

by crisps
3 replies
  • WEB DESIGN
  • |
Can someone help?

I'd like to have a different background colour on each page of my site. For instance, home page to be green, "about us" to be orange, etc.

Anyone know how I can do this rather than just have the same one colour for all pages?

I am using Wordpress.

Thanks.
#background #chainging #colour #page #wordpress
  • Profile picture of the author mywebwork
    The problem is that WordPress "pages" are really just an illusion - they all use the same "page" and just dynamically change content.

    Having said that you could probably do this if you're willing to write some PHP code. You could use the wp_title() variable, which carries the title of the page (or post), and use a conditional statement (i.e. an "if" statement) to check for specific page names. You could then apply a specific style based upon that result.

    Perhaps other Warriors will know of a PlugIn that can accomplish this.

    Good luck

    Bill
    {{ DiscussionBoard.errors[741673].message }}
  • Profile picture of the author adam2000
    Bill's right - there isn't really an easy way to customize each "page" on your WP blog unless you want to do some more php coding.

    I don't know of any plugin that will do this, but you could get a customized theme to do it for you.

    Adam
    {{ DiscussionBoard.errors[745110].message }}
  • Profile picture of the author BlaineGlynn
    You can create a template Page for each page you are using, which isn't too hard, but if your not familiar with wordpress can be confusing at first

    Heres a bit from wordpress.org:

    Creating Your Own Page Templates

    The files defining each Page Template are found in your Themes directory. To create a new Custom Page Template for a Page you must create a file. Let's call our first Page Template for our Page snarfer.php. At the top of the snarfer.php file, put the following:
    <?php
    /*
    Template Name: Snarfer
    */
    ?>
    The above code defines this snarfer.php file as the "Snarfer" Template. Naturally, "Snarfer" may be replaced with most any text to change the name of the Page Template. This Template Name will appear in the Theme Editor as the link to edit this file.
    The file may be named almost anything with a .php extension (see reserved Theme filenames for filenames you should not use; these are special file names WordPress reserves for specific purposes).
    What follows the above five lines of code is up to you. The rest of the code you write will control how Pages that use the Snarfer Page Template will display. See Template Tags for a description of the various WordPress Template functions you can use for this purpose. You may find it more convenient to copy some other Template (perhaps page.php or index.php) to snarfer.php and then add the above five lines of code to the beginning of the file. That way, you will only have to alter the HTML and PHP code, instead of creating it all from scratch. Examples are shown below. Once you have created the Page Template and placed it in your Theme's directory, it will be available as a choice when you create or edit a Page. (Note: when creating or editing a Page, the Page Template option does not appear unless there is at least one template defined in the above manner.)
    Signature
    Please stop digging up old threads to spam your links.
    {{ DiscussionBoard.errors[745120].message }}

Trending Topics