• I have a front page with multiple loops on this site: fashioncow.com. The loops are on the home.php template. The last loop is paginated, using Alchymyth’s code. This all works well (surprisingly).

    The problem is that I want the Previous Entries link to display page 2 in the index.php template, not the home.php template. I want back pages to display like an archive page, with just one loop, skipping the featured post loops that the front page has.

    Is there a way to tell the pagination function to display the query in a certain template?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter photocurio

    (@photocurio)

    I keep thinking this should be easy. I just want:
    https://fashioncow.com/ to load home.php
    and
    https://fashioncow.com/page/2/ to load index.php

    There should be a way to get WordPress to do this.

    Thread Starter photocurio

    (@photocurio)

    If anyone wants to know the solution to this, its a two part thing. The first part is getting WP to load the correct template. I put a template redirect in the functions.php file. See Change template dynamically. I’ve been building Wordpess themes for 3 years, pretty much full time, and this is the first I’ve heard of template redirect. There’s always another layer to WordPress.

    And it works perfectly.. except that now pagination is messed up. If I add an offset to the loop’s query_posts to account for the front page’s featured posts, then pagination disappears. You can’t have both pagination and offset in a query_posts loop. You have to choose one or the other.

    Again, some smarter-than-I programmer has a solution (from 2008). It involves yet more functions, and a loop syntax I’ve never seen before. Its here: How to: Offsets and Paging.

    Finally pagination seems to be working correctly at Fashioncow.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘getting pagination to switch from home.php to index.php’ is closed to new replies.