Sidebar Displays No Matter What

I don’t know if perhaps I’m missing something. For some reason this one is giving me a hard time. All I’m trying to do is set the front page to a template and have another page as a blog index page.

Here’s everything I’ve done and the issues.

  1. Under Reading Settings. Front page is a specific template. Posts page is a blank page with no template. Under config.php for Roots, I’ve added the template to the array to not include the sidebar for the front page template. No matter what I do, the sidebar is being displayed on the front page. By default, is_front_page is there too but that doesn’t seem to be doing anything.

  2. I’d go with front-page.php but then I’d be missing the blog index page which I need.

  3. Setting is_home in config.php won’t work because then the sidebar disappears from the blog index page.

Hope that makes sense. Thanks!

I’m not sure I follow. You say Front Page is a specific template. Is this a template you are using on other pages as well? If not, why can’t this template become front-page.php, that will not affect the blog page if you set the Homepage to be a static page.

In any case, is_home(), somewhat confusingly, does point to the blog index page. If you check, to target the static home page, or front page, it’s is_front_page()

@kalenjohnson I’ve created both front-page.php and template-homepage.php to figure out a solution. If I use front-page.php, I can’t use index.php for a blog index page. If I use template-homepage.php on a page, the sidebar still displays even though it’s added within config.php

Ok, well if you have set a static page for the home page, then you can set a page for the blog posts as well. You can target the blog posts page by using a page-blog.php, that should work.

Or according to the Template Hierarchy, what about home.php?

@kalenjohnson If I set Front Page to the template template-home.php then set Posts Page to a blank page without using any template (like page-blog.php), it should work. This method works as it always have but it’s showing the sidebar on the front page which it shouldn’t be.

Still a mystery to me unfortunately. :frowning:

The front page should have the sidebar disabled out of the box. Have you modified the base file at all?

Here’s part of my base.php

  <div class="wrap container" role="document">
<div class="content row">
  <main class="main <?php echo roots_main_class(); ?>" role="main">
    <?php include roots_template_path(); ?>
  </main><!-- /.main -->
  <?php if (roots_display_sidebar()) : ?>
    <aside class="sidebar <?php echo roots_sidebar_class(); ?>" role="complementary">
      <?php include roots_sidebar_path(); ?>
    </aside><!-- /.sidebar -->
  <?php endif; ?>
</div><!-- /.content -->

And here’s part of my config.php

function roots_display_sidebar() {
  $sidebar_config = new Roots_Sidebar(

  return apply_filters('roots_display_sidebar', $sidebar_config->display);

I can’t see anything obviously wrong. Do you have a custom base file for the front page?

You could try confirming which templates are being loaded with the following (in lib/custom.php or functions.php):

// Bug testing only. Not to be used on a production site!!
add_action('wp_footer', 'roots_wrap_info');

function roots_wrap_info() {  
  $format = '<h6>The %s template being used is: %s</h6>';
  $main   = Roots_Wrapping::$main_template;
  global $template;

  printf($format, 'Main', $main);
  printf($format, 'Base', $template);

Thank you for that. I figured out that this code here is forcing the display of a sidebar. It’s inside my front-page.php.

    <?php query_posts('posts_per_page=1'); ?>
<?php while (have_posts()) : the_post(); ?>
<article <?php post_class(); ?>>
    <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    <?php get_template_part('templates/entry-meta'); ?>
  <div class="entry-summary">
    <?php the_excerpt(); ?>
<?php endwhile; ?>

Any suggestions on what I could do to get the sidebar off from that snippet?

Try resetting the query with wp_reset_query(); directly after the snippet.

Worked! You got a tip jar somewhere? You’ve been extremely helpful. Thank You!

For anyone else that’s looking at this, this only occurs after setting a static page within Reading Settings.

You’re welcome and I’m glad we got it sorted.

We recently set up a tip jar on Gittip for anyone interested in supporting the team, or you could always buy one of our screencasts or plugins.

I just wanted to pop in and say thanks for asking this question and for Foxaii answering it. I was having this same issue and was quite baffled.