• Hi!
    I have a problem while editing a theme: I edited the index page and I replaced it with a custom gallery home page through a new index.php in a child theme.
    Now, I would like to have the old index.php in a wordpress page, so I created a new blog template page with the same code of index.php. The problem is that the_loop in the index.php doesn’t loop through all the posts, but I have to use query_posts() before the loop.
    But, if I use query_posts(‘posts_per_page=X’), both pagination and more tag don’t work.

    What is the difference in using a page as php page or use it as a template?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The query in a page template file only calls the content for that Page. Since you’re effectively creating a page of posts, you have to use a custom query to pull in other Posts. All this could have been avoided if you had left the original index.php template file untouched, created a new page template for your front page’s custom gallery and then created a static front page in WordPress.

    Thread Starter ale152

    (@ale152)

    Uhm… and what is the default index query, so I can use the same one?

    There isn’t a query that you can copy’n’paste. The query is generated based in the template file uses. As soon as you changed index.php and moved to a page template file, you lost that query. You’ll now have to re-construct it using query_posts(). Did you review the example code in the page of posts link above? That should give you a head start.

    Thread Starter ale152

    (@ale152)

    And if I use the same index.php, then how do I link the blog page to the index.php?

    If you follow the process in creating a static front page, the page that you nominate as the main posts page automatically uses the index.php template file.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WordPress page template as index’ is closed to new replies.