Print Reseller Scheme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

background image on a single WP page

Discussion in 'Website Coding & Programming Forum:' started by bigdave, May 15, 2014.

  1. bigdave

    bigdave Moderator Staff Member

    I'm starting to really despise wordpress for it's never ending intricacies!...

    I'm working on a site where the client has requested a specific page has an edge to edge background image. the max-width of the body is 960px so I cant contain the image within body tags but I wondered if php might come o my rescue?

    Could I use something along the lines of

    if ( is_page( 'nameofpage' ) ) {
    get_header( 'nameofpage' );
    } else {

    within the page.php file work to call a header containing a dedicated css file including the html background imange requested?
  2. Corrosive

    Corrosive Moderator Staff Member

    I feel your pain... Oh no, wait, no I don't :icon_wink: That'd take you 15 seconds with a template variable in Modx but that would be far too logical for Wordpress.
  3. hankscorpio

    hankscorpio Moderator Staff Member

    bigdave likes this.
  4. bigdave

    bigdave Moderator Staff Member

    Will have a look.
  5. Edge

    Edge Active Member

    Create a new template with a body class you can leverage which is a slight variation on the default template (or whatever you are using for that page) - then use the new template for that page. Use the body class on the new template to change the max width to 100%. Put a container div inside with max width 960px. Now you can set your background image on the body element. Story. End of.
  6. bigdave

    bigdave Moderator Staff Member

    The solution I used was to use the ID given to the page by wordpress (in this case page-id-18) so..{
    background: url('img/resbk.jpg') no-repeat;
    background-size: 100%;

Share This Page