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

Quick, simple. I have front-page.php working in Wordpress, and these loops over the main loop for my latest posts. The problem is the pagination template.

When I get to site.com/page/2, it shows the same file template front-page.php, but with the second round of posts. What I want is to show other file template, like paged.php, but not even archive.php or date.php shows up.

Is there a code for this, instead of writing if (!is_paged()) wrapping the entire front-page.php?

share|improve this question
up vote 1 down vote accepted

Add a filter to frontpage_template and check the paged query var, adding your own template when it's beyond the first page. I use paged.php in this example:

function wpa56889_template_filter( $templates = '' ){
    $paged = get_query_var( 'paged' );
    if( $paged > 1 ) :
        if( !is_array( $templates ) && !empty( $templates ) ) :
            $templates = locate_template( array( "paged.php", $templates ), false );
        elseif( empty( $templates ) ) :
            $templates = locate_template( "paged.php", false );
        else :
            $new_template = locate_template( array( "paged.php" ) );
            if( !empty( $new_template ) ) array_unshift( $templates, $new_template );
    return $templates;
add_filter( 'frontpage_template', 'wpa56889_template_filter' );

Note the Filter Hierarchy Codex entry incorrectly lists the filter as front_page_template, but the function that applies this filter appears to sanitize the underscore from the variable before calling it, making it just frontpage_template.

share|improve this answer
Excellent! Thanks. – DarkGhostHunter Jun 29 '12 at 2:14

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.