• Resolved Jam

    (@pimaniii)


    [moderated]
    I would like to remove that red background part on all of my pages except the home page. So I created a new file called nonhomepage.php and copied/paged the page.php code into it. Now I can select that as an option for my non-home pages.

    However, I do not see the code for that red background in my page.php, so I can’t remove it.

    Any thoughts?

Viewing 9 replies - 1 through 9 (of 9 total)
  • the red is the background image from the body style:
    themes/redwhite/images/main_bg.jpg

    try and add body_class() to the body tag in header.php; that will give you extra css classes to style individual pages different:
    https://codex.www.ads-software.com/Function_Reference/body_class

    Thread Starter Jam

    (@pimaniii)

    Ok, thanks! I will try that out. I noticed that it also contains the header, so can I just crop that out and replace it?

    Also, can you please remove the link to the website for privacy? Thanks!

    or write a bit of code to add a css class just to the body tag of the home page:

    for instance, edit the <body> tag in header.php to look like this:

    <body <?php if( is_home() || is_front_page() ) echo ' class="homepage"'; ?>>
    (you might need only one of the conditional tags (?))

    and in style.css:

    body.homepage { background-image:none; }

    (btw: you can edit your own replies for at least 30 minutes)

    Thread Starter Jam

    (@pimaniii)

    Thank you! I will give that a try

    oops; done.
    (automatic action without thinking ?? – it’s getting late)
    you can add the link to the site anytime, if it is needed.

    the header part:
    if you need the grey top, you probably need to make a new background image for the home page.

    Thread Starter Jam

    (@pimaniii)

    Hmm ok I tried your second idea, but it did not work. You wrote on body.homepage to have no bg image, but I do want the image on the homepage, just not on any other page.

    Also, Because a part of that image include the header, I am editing it to remove the red area.

    So how can I have a DIFFERENT bg image for other pages?

    Thanks

    this is how it is now:

    body { background:#fff  url(images/main_bg.jpg) top center repeat-x; font:13px Arial, Verdana, Helvetica, sans-serif; color:#494949; padding:0; margin:0; }
    body.homepage { background-image:none; }

    change it to:

    body { background:#fff; font:13px Arial, Verdana, Helvetica, sans-serif; color:#494949; padding:0; margin:0; }
    body.homepage { background: #fff url(images/main_bg.jpg) top center repeat-x; }
    Thread Starter Jam

    (@pimaniii)

    Ok, so I changed it to

    ody { background:#fff  url(images/main_bg-alternate.jpg) top center repeat-x; font:13px Arial, Verdana, Helvetica, sans-serif; color:#494949; padding:0; margin:0; }
    body.homepage { background: #fff url(images/main_bg.jpg) top center repeat-x; }

    It worked!

    Thank you Very Much for your time and effort!

    Also, Because a part of that image include the header, I am editing it to remove the red area.

    So how can I have a DIFFERENT bg image for other pages?

    body { background:#fff url(images/main_bg_general.jpg) top center repeat-x; font:13px Arial, Verdana, Helvetica, sans-serif; color:#494949; padding:0; margin:0; }
    body.homepage { background: #fff url(images/main_bg.jpg) top center repeat-x; }

    the above assumes that you call the edited image main_bg_general.jpg

    the original main_bg.jpg (with red) will be shown on the homepage; the edited main_bg_general.jpg will be shown otherwise.

    PS: well done, and fast ??
    i am off for now …

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Create new page template without an element’ is closed to new replies.