Thesis Tutorial — How To Remove Sidebars, Header And Footer From Specific Pages In Thesis

The website is a collection of different web pages where each page is designed for a specific purpose. The Home page presents the overview of the website while services pages are designed to pitch your services and the FAQs focus on providing support and help to the clients.

Each webpage is designed bearing the primary purpose in mind and thus may not require to feature sidebars, header and footer. As a general assumption, the services/product featuring pages essentially are the landing page of the website and thus need to be designed with minimal elements and the blog on the other hand should be highly interactive and provide relevant post links as featured posts, relevant posts or archives in sidebars and footers. Thus the elementary requirements of each page vary and thus you may at times need to:

  1. Remove The Sidebars From Specific Pages (Or Posts)
  2. Remove The Header From Specific Pages (Or Posts)
  3. Remove The Footer From Specific Pages (Or Posts)

Remove The Sidebars From Specific Pages Or Posts In Thesis

Thesis features a “No Sidebars” page template which makes it simple and easy to remove the sidebars from the specific pages. Here is a simple tutorial to do so.

  1. Login to WordPress and click Pages in the left panel.
  2. On the Pages screen select the page for which you want to remove the sidebars and click Edit to activate the edit mode.
  3. Locate Pages Attribute section in the right-hand side and select No Sidebars from Template drop-down menu.

    Select No Sidebars to remove sidebars on specific pages
  4. Update the page.

To remove the sidebar from particular posts / single posts page follow the steps given below:

  1. Open custom_functions.php in the editor of your choice (learn how to edit custom_functions.php).
  2. Add the following code to hide the sidebars from specific posts.
    
    function show_rem_sidebars() {
    if (is_page('7')) // For single posts you can use is_single() and pass the Post ID as parameter
    return true;
    else
    return false;
    }
    add_filter('thesis_show_sidebars', 'show_rem_sidebars');

Check out the ultimate guide on sidebar customization to do more with the sidebars.

Remove The Header From Specific Pages Or Posts In Thesis

Thesis provides a filter thesis_show_header which allows you to specify the pages for which you want to show / hide the header. Add the following code to your custom_functions.php to remove the header from the specific pages.


function show_rem_header() {
if (is_page('7')) // For single posts you can use is_single() and pass the Post ID as parameter
return true;
else
return false;
}
add_filter('thesis_show_header', 'show_rem_header');

Remove The Footer From Specific Pages Or Posts In Thesis

Just like the filter for determining the execution of header, Thesis provides a filter thesis_show_footer which allows you to specify the pages for which you want to show / hide the footer. You can remove the footer from the specific pages by adding the following code to your custom_functions.php.


function show_rem_footer() {
if (is_page('7')) // For single posts you can use is_single() and pass the Post ID as parameter
return true;
else
return false;
}
add_filter('thesis_show_footer', 'show_rem_footer');
Posted In:

WordPress Support & Maintenance, Code Snippets, Thesis WordPress Theme Framework

16 Comments

  1. When I use these codes it removes the header, footer, and sidebars from every page not just one. Do you know why?

    Reply
  2. Hi there,

    thanks for this comprehensive tutorial; I tried it to ensure I could target a single page, which worked great.

    Do you by any chance know how just to remove the header, but still leave the nav bar & feature box in place? I’ve tried this code from the support forum, to no avail:
    function remove_header() {
    if (is_home()) {
    remove_action(‘thesis_hook_header’, ‘thesis_default_header’);
    }
    }
    add_action(‘thesis_hook_before_html’, ‘remove_header’);

    thanks!!
    Tracey

    Reply
  3. Oops – meant to say, I only want to remove the header on one single page…
    thanks…

    Reply
    1. As per your code the header will be removed only from the home page (provided that the code works; I haven’t tried it). To exclude a single page instead of is_home(), you can use is_page(‘yourpagenumberORtitleORslug’). To remove it froma post use is_single(‘yourpagenumberORtitleORslug’).

      Reply
  4. Hi Shivanand, my question was, do you know ONLY how to remove the banner (image) instead of everything in the header? Your code works but it takes away more than I would like, hence my query – if not, I’ll ask again in the forum 🙂 Many thanks!

    Reply
  5. I made a slight modification to help with excluding more than 1 page: Added the “array”

    function show_rem_header() {
    if (is_page(array(’38’, ’11’, ’26’, ’13’, ’21’, ’19’, ‘7’))) // For single posts you can use is_single() and pass the Post ID as parameter
    return true;
    else
    return false;
    }
    add_filter(‘thesis_show_header’, ‘show_rem_header’);

    Reply
  6. Hi, I have the same question as tracy. I would like to remove the banner in my header and leave the nav bar, is there a way to do this?

    Reply
  7. Lucas, I did manage to sort this out, but as it was about 5 months ago, I’ll have to try & remember what I did…

    Custom.css : suppress header on home page only
    .custom.home #header {
    background-image: none;
    height: 0;
    }

    Custom Functions:
    remove_action(‘thesis_hook_before_header’, ‘thesis_nav_menu’);
    add_action(‘thesis_hook_after_header’, ‘thesis_nav_menu’);

    I then used NivoSlider to add slides to the feeature box in the header area instead, customising the width etc. in the Custom,css file

    I trust this helps – I got this all from the Thesis support forum so if you struggle, I suggest you log on there for more assistance…

    Reply
  8. Got a question for you. First of all this is an AWESOME tutorial. It is exactly what I needed and it worked. My question is how do you hide the header for more than one page? I have three pages I turned into optin pages and I am split testing them and I want to hide the header on three pages. I was able to use your code to hide the pages on one of them, but I want to hide the other two. I appreciate your work.

    Reply
    1. @Yegyan: Please try if(is_page('7') || is_page('32') || is_page(45)) instead of if(is_page('7')) Of course, replace the page ids with the page id of your pages.

      Reply
  9. Thanks for the fast response. Unfortunately when I put your code in there in its original state it is actually removing the header from ALL pages. In the editor, there is this code present (Below) and that is probably why. Would you be able to suggest a way to adjust the code to keep all the headers there except for just the pages I select?

    The existing header code:
    function header_script () {?>
    <script type="text/javascript"
    src="/custom/js/moveaddtocart.js”>

    <script type="text/javascript"
    src="/custom/js/setmenuwidth.js”>

    <script type="text/javascript"
    src="/custom/js/jquery.hoverIntent.minified.js”>

    <script type="text/javascript"
    src="/custom/js/dropdown.js”>

    <?php }
    add_action('wp_head', 'header_script');

    Reply
  10. @Yegyan: Can you pls send me your custom_functions.php (pls upload it to some filesharing site) and also let me know the address of your site.

    Reply
  11. This worked for me… thank you 🙂

    Reply
    Info

Comment on Thesis Tutorial — How To Remove Sidebars, Header And Footer From Specific Pages In Thesis

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