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.
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.
I’d go with front-page.php but then I’d be missing the blog index page which I need.
Setting is_home in config.php won’t work because then the sidebar disappears from the blog index page.
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 http://codex.wordpress.org/Conditional_Tags, 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.
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);
}