How do I visit archive-post.php?

I have a simple file with the loop in it to get all posts called archive-post.php, but I’m not sure how I get to it in the URL?

http://www.examples.com/post/ gives me a 404

How can I see the archive of all my posts (not custom post types)?

2 Answers
2

You don’t, archive-post.php doesn’t exist, it’s just archive.php, and on most sites the post archive is the root of the site, aka /. Depending on how you’re viewing posts it’ll use home.php, front-page.php, index.php, etc. You should refer to the template hierarchy diagram, but remember, the standard post post type is a special case, as are pages

Perhaps adding your own rewrite rules, or specifying post_type=post in the URL as a query variable, or toggling the pre_get_post filter that’s adding your custom post types to the main query

If you’ve set a page as your homepage, there is an option directly next to that option that lets you set the posts page, which will give you what you want. ( as a sidenote, you don’t need to set a page as your homepage to give it a custom design, that’s what the home.php template is for )

For example, this is my own site:

enter image description here

Where posts is a page called posts at /posts/. Of note, it will not use a page template if I assign one to that page, it uses the archive/index templates instead

Leave a Comment