• Resolved carosea

    (@carosea)


    I would like to have an image as the background on pages and then put content on top of these – is there an easy way to do this. Ideally it would be good to have an option to assign a different image if required for each page background (and to fill the width) but would be ok if it had to be all the same.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You can add a background image under Appearance > Background.

    Setting a per-page background image would be possible with some custom CSS, instead of going the above route.

    The code would be something like this for a repeating background image:

    body.page-id-1051 {
       background: url(https://path/to/your/image.jpg);
    }

    Replace the unique page or post ID with the one from your site that you want to target. You can see it by viewing your browser source and looking at the body tag.

    Don’t edit the theme files directly, otherwise your changes will be overwritten whenever the theme is updated.

    An easy way to add custom CSS is to install the Jetpack plugin and activate the Custom CSS module. You’ll then add your custom CSS in the new stylesheet editor that’ll appear in your dashboard, under Appearance > Edit CSS.

    As alternatives, you could either install a standalone custom CSS plugin, or create a child theme.

    Thread Starter carosea

    (@carosea)

    Kathryn
    Thanks for the answer but I have realised want I am actually trying to do is to put the image on the post background rather than the page. I tried the css coding in my child theme using the post id but it didn’t seem to work.
    I will keep trying but any suggestions welcome!

    If you’d like to put the image on the post background, you can use CSS along these lines:

    .postid-123 .hentry {
       background: url(https://path/to/your/image.jpg);
    }

    Again, you can replace the post or page ID in that CSS with the one you want to change the background for.

    Thread Starter carosea

    (@carosea)

    That is all fine now thanks for your help

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Image as background to page’ is closed to new replies.