Support » Fixing WordPress » change background by page id

  • Resolved stephanie_2


    how can i change my background by page id ?

    i tried this:

    body {
            background-color: #000;
            background-image: url("back2.jpg");
            background-attachment: fixed;
    	color: #999999;
    } {
    background: #000;
            background-image: url("back1.jpg");
    } {
    background: #000;
            background-image: url("back.jpg");
    } {
    background: #000;
            background-image: url("back3.jpg");

    doesn’t work:(

Viewing 8 replies - 1 through 8 (of 8 total)
  • Michael


    Forum Moderator

    did you try to refresh the browser cache by reloading the page, or by pressing ‘ctrl f5’ ?

    does you theme actually use body_class(); ?

    maybe try to use background-color: #000;

    still, theoretically, is should work.

    is your code in style.css?

    where are the images located?

    do you have a link where this problem can be seen?

    thank you alchymyth! …shure make alway refresh and empty cache.
    i also changed it to background-color:
    doesn’t work
    what is a body_class();???
    where and how do i have to have it?
    thank you!!!

    ok, i put this: <body class=”page-id-<?php the_ID(); ?>”>
    in my header.php before the header close container…
    have no idea how and why it should function or not…

    Moderator keesiemeijer



    try this:

    <body <?php body_class(); ?>>

    oh keesiemeijer! IT WORXXXX! thank you so much!!!!:)

    Stephanie: NO! that line must be after the </head> tag since the “<body>” is where the page beings.

    You should try this:

    <head ... >
    ... the head content (descriptions, title, meta, css, js, etc) ...
    <body <?php body_class(); ?> >
    ... the site html/css/php/etc content ..

    The body_class() is a WordPress function that automatically adds the right classes to the body tag of your theme.

    Let me know if this help you to solve your issue.


    Oh.. glad to read that!

    thanks davoscript! …sorry i mean head container

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘change background by page id’ is closed to new replies.