Change index.php template


I’m struggling for days to change the index.php. I wan’t to create a blogroll without the sidebar and include a hero image above the post query. I tried several thing for example:

  • create a new template and call the index.php - result: still the old template
  • create a new template and do a custom query in the template - result: empty page

Many thanks beforehand for your help.


There is nothing different about the template hierarchy in Sage versus any other WordPress theme.

maybe you mean the front-page.php ?

Thanks I know how the template hierarchy works. Well, at least for everything else except this posts archive.

I have a file called base-archive.php with following code:


namespace Roots\Sage;

use Roots\Sage\Config;
use Roots\Sage\Wrapper;


<?php get_template_part('templates/head'); ?>
<body <?php body_class(); ?>
	<?php get_template_part('templates/nav'); ?>
  <!--[if lt IE 8]>
    <div class="alert alert-warning">
      <?php _e('You are using an <strong>outdated</strong> browser. Please <a href="">upgrade your browser</a> to improve your experience.', 'sage'); ?>

  <div class="wrap" role="document">
    <div class="content row">
      <main class="main" role="main">
        <?php include Wrapper\template_path(); ?>
      </main><!-- /.main -->
      <?php if (Config\display_sidebar()) : ?>
        <aside class="sidebar" role="complementary">
          <?php include Wrapper\sidebar_path(); ?>
        </aside><!-- /.sidebar -->
      <?php endif; ?>
    </div><!-- /.content -->
  </div><!-- /.wrap -->

  <?php get_template_part('templates/footer'); ?>

  <?php wp_footer(); ?>
<script type="text/javascript">
      $("#menu, .content-info").toggleClass("active");
      $(".wrap, .content-info").toggleClass("active");
<script type="text/javascript">
$(window).scroll(function() {
if ($(this).scrollTop() > 50){  

I have a file template-archive.php


    Template Name: Template Blog
    <?php get_template_part('templates/archive'); ?>

and in the folder templates archive.php

<?php get_template_part('templates/page-header'); ?>

<?php if (!have_posts()) : ?>
  <div class="alert alert-warning">
    <?php _e('Sorry, no results were found.', 'sage'); ?>
  <?php get_search_form(); ?>
<?php endif; ?>

<?php while (have_posts()) : the_post(); ?>
  <?php get_template_part('templates/content', get_post_type() != 'post' ? get_post_type() : get_post_format()); ?>
<?php endwhile; ?>

<?php the_posts_navigation(); ?>

It’s returning the posts. But it’s not returning the H1 from base-archive.php or base-template-archive.php. It’s still getting it’s layout from base.php.

Is there anyone with a solution for this?


The reason why template-archive.php will not load base-archive.php is because you dropped part of the template name.

All you ever need to do is prefix base- to the full template name e.g. base-template-archive.php will load when template-archive.php loads.

You should also re-read the template hierarchy as it’s likely home.php or archive.php would be a better place to start when customising your blog pages.

Hi ,

Thanks for your quick response! As mentioned at the bottom of my previous response I tried the right convention template-archive.php. Still it loads the base.php. I wan’t to make a change to the header and footer layout for the blog page, changing only the archive.php doesn’t bring me succes.

Appreciate your help!

If what I posted isn’t working then it’s because template-archive.php isn’t being loaded.

Have you set your page as the “posts page” in the dashboard? If so you will need to start with home.php as I mentioned above. The WordPress template hierarchy will only ever use home.php or index.php for the “posts page”. All other templates are ignored, including custom page templates. It’ll be mentioned on the codex somewhere if you search.