[Resolved] How to set same background image on multiple (but not all) pages with one code

Home Forums Support [Resolved] How to set same background image on multiple (but not all) pages with one code

Home Forums Support How to set same background image on multiple (but not all) pages with one code

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #945570
    Roslyn

    Can I use one piece of code to set the same background image on multiple pages, rather than plugging each one in separately?

    Here’s the code I’ve been using, but now I’d like to use the same image for background on quite a few more pages:

    body.page-id-xx {
    background-image: url(http://IMAGE-URL-HERE);
    }

    Thank you for your assistance!

    #945645
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    This is a tough one..

    You could add a custom field to each page, and then add a body class to those pages if they have a custom field. I’m not sure it’s worth the time to add the custom field, though?

    It may be easier to just do this:

    body.page-id-xx,
    body.page-id-123,
    body.page-id-456 {
        background-image: url(http://IMAGE-URL-HERE);
    }
    #945935
    Roslyn

    Yahoo!! That works great! (Oh, what a comma will do!)

    Thanks very much!

    #946215
    Tom
    Lead Developer
    Lead Developer

    You’re welcome 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.