I have


When I go to domain.com, it loads index.php, which is expected.

But, when I go www.domain.com/page/2/, it loads the correct posts (as in, the posts in the second page), but uses in index.php template. I want to load the archive.php template. How is this achievable?

2 Answers 2


archive.php is not used for subsequent pages of non-search, non-taxonomy, ... based subsets of content.

I think you might be looking for paged.php (but that'll also be used for the first page).

Alternatively add logic to index.php to call a different template where page number is greater than one.

Correction on reviewing http://codex.wordpress.org/Template_Hierarchy#Visual_Overview pages.php is not the answer. Paged (ie. not single) posts use home.php otherwise index.php only.

So you'll need to put in your own logic (presumably to home.php) to use index.php or some custom template for posts.

(This answer shows the WP logic to decide which template to use.)

  • Yes thanks that's what I eded up doing. I just used if .. else
    – 21zna9
    Jul 18, 2012 at 21:47

Here's how you would do this, as it is not a native feature of WP.

Basically, check if $paged is set, which you can do by calling is_paged() inside a conditional.

<?php if ( ! is_paged() ) : 
// code for home page 
// code for archive page

Making use of templates can make this index.php still look tidy/neat.

You're going to need to make sure you're doing this, though:

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?> 

Before either the home query or the archive query.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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