WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a custom page 2 template that's different from the main index.php. For example, the main index page would display the latest news + a lot of features like a magazine. When readers click to read on to page 2, 3, 4 etc of the news posts, they are taken to a more regular news page. Kinda like something on theverge.com (at the bottom, click "next page" and see what I mean).

Anyone have any ideas on how to do this? I know it's possible to create archive pages for categories and tags, but I'm not sure how to do it for the index.php.


share|improve this question
At least, you should disclaime that you are cross-posting... stackoverflow.com/q/11285094/1287812 – brasofilo Jul 1 '12 at 23:02
@Bill if one of the answers below worked for you, please MARK it as the answer. :) – its_me Jul 3 '12 at 3:11
up vote 3 down vote accepted

I would use the is_paged() conditional inside index.php to load two separate templates containing your layouts. Something like this:

if ( is_paged() ):
   get_template_part( 'content', 'first-page' );
   get_template_part( 'content', 'paged' );

Assuming you have two templates, content-first-page.php and content-paged.php.

Edit: If you just want a different template for part of your index page, try this:

if ( !is_paged() ):
   get_template_part( 'content', 'middle' );    

Put that wherever you want the extra template to load.

share|improve this answer
Thanks man, that seems to have done the job. I don't think the index and subsequent pages are that different, the index page basically has an extra section of content before the footer. Is there a way of including this section (e.g. "middle.php") via php include only on the main index page and not the other pages (page 2, 3, 4 etc.)? Thanks again! – Bill Jul 2 '12 at 23:55
You can use my code for that purpose with a few modifications. – Joseph Leedy Jul 3 '12 at 12:09

@Joseph's answer is probably what you're after. But if the first and subsequent pages are going to be sufficiently different so as to require a complete different template you can hook into the template_include filter.

function wpse57122_change_on_p2( $template ){
    if( is_front_page() && is_paged() ){
        $template = locate_template(array('archive.php','index.php'));
    return $template;

This alters the default template used for pages 2 and higher of the 'front page' (see is_front_page and is_paged()). The locate_template searches the (child and parent) theme for the given templates - in the order given to it. In this example, it will use archive.php for pages 2 and above- if that template doesn't exist, it will use index.php instead.

share|improve this answer

Your Answer


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.