Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My homepage has 1 featured post, followed by 4 posts stacked 2 on 2, like this:

enter image description here

The featured post is only shown on the first page so the second page shows the older posts stacked 2 by 2 as above.

However, I'd like to be able to change the layout on the second page, showing the posts in full width and length. Any way to do this?

tl;dr = How can I make the second page look different from the first page?

share|improve this question
    
are you aware of the conditional tag is_paged() ? codex.wordpress.org/Function_Reference/is_paged –  Michael Feb 25 '12 at 15:16
add comment

2 Answers 2

up vote 1 down vote accepted

To load override WordPress' choice of template you can use template_include filter and then use the locate_template to return the the template file path (if it finds it).

The file-name passed to locate_template must be the name of the template file name (which should be in you theme/child-theme directory).

//Loads template customtemplate.php from your theme folder on page 2+ of the 'main page'
function my_second_main_template($template){
    if (is_home() && is_paged()){
         $alternate_template = locate_template( 'customtemplate.php');
         if(!empty($alternate_template))
              $template =$alternate_template;
    }
    return $template;
}
add_filter('template_include','my_second_main_template');
share|improve this answer
    
Seems to do the trick. I've made a new template and going to the second does use that new layout but it also repeat the body from the front page after the custom template.... –  Jannemans Feb 25 '12 at 18:00
    
@Jannemans I've updated my code, see if that fixes it :D –  Stephen Harris Feb 25 '12 at 18:22
    
Works! Thanks a bunch :) –  Jannemans Feb 25 '12 at 18:29
add comment

If I understand your question correctly, I would make a separate template for home.php and a separate template for archive.php to achieve this.

share|improve this answer
    
This won't work - page 2 of the main page will still use the same template as the main page. –  Stephen Harris Feb 25 '12 at 15:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.