Create custom post archive for Divi theme
3
What is the Custom Post Archive?
It’s the way that WordPress follows to display your custom post entries when you visit your custom post archive page.
How to visit your current custom post archive?
In our example, we have a custom post called ‘Catalog’ created by ‘Types‘ plugin. And our permalink setting is set to ‘Post name‘. So when we need to visit our custom post archive, we go to http://mysite.com/catalog
To create a custom post archive in Divi theme:
In Divi theme, the custom post archive is been displayed using template file: index.php
1- Locate index.php
in your Divi theme files and make a copy of it.
Please note, it’s highly recommended to create a child theme and move that file to it. If you don’t have a child theme for Divi, you can get DiviColt for free. It’s a minimal Divi child theme.
2- Rename that copy to archive-{posttype_slugname}.php, in our example it would be archive-catalog.php
3- Start editing your newly created file, Divi will use this file to display your catalog (custom post) posts.
Not using Divi?
So what! The same can be done with any other WordPress theme following these steps:
1- Create new PHP file and name it archive-{posttype_slugname}.php
2- Start editing that file, basic template should be something like this:
3- Once you’re done, upload that file to your theme’s directory (remember the child theme, learn how to create one in 2 minutes), then WordPress will display your custom posts using the template you just created.
More about custom archives
- 3Shares