New index page - best approach

I’ve looked quickly at the wrapper explantion but want to know the best way to change the main blog front page that displays the posts. I want the base.php to style it but want to customise the display of the posts on the blog front page (I already have a custom static front page).

I can see that if it is the blog home then the index.php selects the tempate content.php; i assume this is because the template function ‘get_post_format()’ selects ‘blank’ as the return and it just loads content.php? However, is the best way to have a new looking blog home (index) to customise the content.php or create a new template and select this somehow? For now in index.php I have added an if statement to check is_home() then display a custom template rather than let the get_post_format select content.php.

thanks

If you’re using the latest posts as the home page and not a static page, you can copy index.php to home.php and modify that file to your needs

Hi, no I have a static front page.

Using a conditional to load a custom content template is fine. But you won’t be changing the template loaded by the template hierarchy, so you will need to manually set the base file:

<?php
add_filter('roots_wrap_base', 'roots_wrap_base_home'); // Add our function to the roots_wrap_base filter

function roots_wrap_base_home($templates) {
  if (is_home()) {
    array_unshift($templates, 'base-custom-home-base.php'); // Shift the template to the front of the array
  }
  return $templates; // Return our modified array with our custom home base at the front of the queue
}
?>

thanks foxaii - do I need to change the template loaded by the hierachy? sorry if i’m being dull.

You don’t need to change the template chosen by the hierarchy to select a different base template. The function I posted does that. The function enables you to change base markup without having to duplicate content markup (the template chosen by the hierarchy).

Of course if you are changing the content markup and the base markup, you don’t need the function and can just create both templates. In your case that’s home.php (duplicate the index) and base-home.php (duplicate the base).