I need to create custom page template which will not have header background image

what I want to do - I want to have a slider set as a background image on my front page, but want all the rest of the pages not to have it (slider behind the title). Is there easier way to do that?

You can create a custom page template if you want. For instructions on that, read this documentation. You can also see a page template built into the theme for a good starting point. In your theme file, look at the file page-guestbook.php

Now, you also might be able to achieve your goal by using Custom CSS. Every WordPress page or post is assigned a unique class in the <body> tag. So for example, If I wanted to change the background image for my home page, I would insert the following Custom CSS.

// Change body background for a specific page with post_id == 2
body.page-id-2 {
    background: url("http://wordpresscanvas.com/wp-content/uploads/2013/10/YOUR-IMAGE-FILE.jpg") repeat center top scroll;
}

// Remove header background for a specific page with post_id == 2
body.page-id-2 .site-header {
    background: none;
}

 

4 thoughts on “I need to create custom page template which will not have header background image

  1. Hi Chris

    I like the CSS solution.
    Can it be configured another way around – instead of listing pages that should not have title background image, making it as a default and list pages that do?
    And I just assumed, but can you confirm that I can actually use the responsive slider (layer slider) as a header background?

    1. Yes. In theme options, you could simply leave the background option values empty. Then, through your Custom CSS editor, you could set the background header image on specific pages.

      And no, there is no way to use the LayerSlider plugin as a background. Nor can it go in the header. If you have a unique feature that you would like be made a plugin, or included in the Canvas theme, make your requests here.

    1. Your suggestion would not work. For what you are trying to do, I would suggest creating a new page template and change your HTML structure the way you need it to be. And if you do make changes to the theme files, just make sure you disable automatic updates so your changes do not get erased.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>