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.
Thanks!
2 Answers
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' );
else:
get_template_part( 'content', 'paged' );
endif;
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' );
endif;
Put that wherever you want the extra template to load.