Learning from this tutorial, I added a blog page, using the admin panel, to an already running website that has a custom theme made from scratch (by someone else). But the new blog page, didn't show anything other than the website footer in the beginning, so I added a piece of code in the index.php, and fixed it... Now when example.com/blog/ is called, the blog posts are drawn.

I want to follow the common/correct convention, and perhaps have another file like archive-post.php do the task. I am not sure how to do that. I read Post Types & Template Hierarchy. I don't Understand if WordPress automatically follows that template hierarchy, or It is just a recommended practice, and I should use get_template_part, to make such a hierarchy. If so, is using get_template_part the correct way?

2 Answers 2


You don't need to rename the archive.php as archive-post.php. Cause it is default to post for archive.php. If you have any other post type then use archive-{post_type}.php for pointing this template to this post type.

Now come to get_template_part(). It is used for breaking the large code base of the template to single part so it can be managed easily as well as be reused. So it's better to use it. Cause it makes development and code maintain easy.

Hope that helps.

  • Thanks for the answer. There was no default archive.php in the beginning, and I added the first one. But still only the index.php is called for blog page and blog posts. Do i have to MANUALLY divert the execution path to the archive.php, or is it supposed to happen automatically?
    – Makan
    Commented Jan 4, 2017 at 11:56

Use the categoey.php template as this is effectively what archive-post.php would be. The archive.php template is used as a template for all post types unless a more specific template can be found.

I highly recommend studying the WordPress template hierarchy, which is summarised visually as either the image or interactive version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.