Forums

Change Background for every page (..and categories) (5 posts)

  1. davidino1978
    Member
    Posted 3 years ago #

    hi,
    I'm quite new of Wp...

    how can i change background of my pages?
    I've read some post but i don't come out...

    http://wordpress.org/support/topic/138522?replies=13

    http://wordpress.org/support/topic/154587?replies=1

    What i see in the final code is that for every page there is not a reference ID for body class. The body tag always look link this:

    <body class="page-">

    thanks for every reply
    david

  2. Samuel B
    moderator
    Posted 3 years ago #

    In the theme's style.css where it applies to pages

  3. davidino1978
    Member
    Posted 3 years ago #

    Yes but if my output in code is <body class="page-">

    and not for ex: <body class="page-12">

    who can i edit a body style for ID page-12...?

    I read the post i link but somethings dont goes..., i need to apply different background for each page, home: orange background, info: green background ect

  4. Samuel B
    moderator
    Posted 3 years ago #

    good luck with that

  5. Eric Amundson
    Member
    Posted 3 years ago #

    In order to add a unique class to the body tag, you need to:

    1. have the body tag within the Loop, which it's usually not by default, and
    2. use conditional tags like they're described in the posts you pointed out

    Difficult thing is that most themes split header information into a header.php file and the page.php, index.php and single.php (and other templates) are separate files.

    In all of my themes, the header.php file contains the opening body tag, but the Loop actually is contained within the index.php, page.php, single.php, etc.

    So, it would require theme surgery to extract the Loop and start it before the opening body tag. Then you can use conditional tags to test if it's a page and insert the appropriate ID or class.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.