Skip to content

Default Posts Archive Page

jklina edited this page Feb 6, 2013 · 3 revisions

This article will summarize how to create a page in Wordless that shows only an archive of the default post type. With custom post types its easy to create archives that display only your custom post type because Wordpress gives you a name spaced url and you can use is_post_type_archive("%custom_post_type") to check if you're accessing an archive for your custom post type.

You cannot however use is_post_type_archive("post") so this strategy fails for the default post type. To get around this try the following:

Create a new page (let's say 'news').

Set the "Posts Page" in the backend under Settings > Reading > Front Page Displays to the page you created (in my case 'News')

In your index.php add a route that looks like

} else if (is_home()) {
  render_view("posts/archive");

The is_home() method checks if this is the designated page you set in the backend and if it is it supplies a listing of all your posts.