Site logo

Archived topic

Differents Background images

5 replies · Started by Evadex on June 24, 2017

Viewing posts 1–6 of 6

Hi,
I would like to know how to use an background image for home and differents background images for other templates ?
I tried to use a child theme and a child template but when I put a picture in the body of my home child template, I can see this picture in every templates.
Have you got a solution for a beginner like me ?
Thank you very much !
Yvan
FYI : I'm using GP Premium 1.3.1

Hi there,

Each page has a unique class in the <body> tag.

You would first need to find the page/post ID – it’s actually hidden in your URL when you are logged in. Look for post= and that number is your page ID.

Or you can use a plugin: https://wordpress.org/plugins/reveal-ids-for-wp-admin-25/

Then your CSS would be something like this:

.page-id-xxxx {
    background-image: url('URL TO THE IMAGE');
}

Let me know if this makes sense.

Hi Leo,
Thank you for your answer but I don't know if I have to use your code into the style.css or other ? In the child theme or Parent ?
Thank you very much for your help

Are you going to do lots of customization outside of the customizer?

If not you might not need a child theme.

The easiest way to achieve this is actually to use Tom's Simple CSS plugin. It has a meta box for each page so you can just add this CSS in without knowing the page ID.

body {
    background-image: url('URL TO THE IMAGE');
}

Simple CSS: https://docs.generatepress.com/article/adding-css/#simple-css

As Tina Turner said : "you're simply the best" !
Simple Css, your code and a good url after that it's perfect !
Thank you very much and have a good day or evening !
Best regards
An happy French beginner

You're very welcome :)

This archived topic is closed to new replies.