Are you trying to make a special archive page for your custom post types in WordPress but feel it’s too hard?
You’re not alone! Many people find customizing WordPress difficult.
In this article, we’ll show you step-by-step how to easily create a custom post type archive page in WordPress.
Creating a Custom Post Type Archive Page in WordPress
What Is a Custom Post Type Archive Page in WordPress?
Handling content on your WordPress site can get messy, especially with different types of content like portfolios, testimonials, or products.
The default archive templates don’t always match your brand’s style, leading to a cluttered look that can frustrate visitors.
A custom post type archive page shows all items under a specific custom post type.
When you create a custom post type, WordPress automatically makes archive pages for it. The archive page lists all posts of that custom post type, making it easy for visitors to browse and access the content.
By default, WordPress has two post types: Posts and Pages. Plugins can add their own post types, like WooCommerce, which adds a Products post type.
You can also create custom post types for different content.
Once created, you can use the custom post type in the WordPress admin area. But your theme controls how the content appears.
If your theme doesn’t have a template for a specific post type, WordPress uses the default archive template to show any post type archive page.
To learn more, see our guide on WordPress template hierarchy.
If you want to change how your custom post type archive page looks, you can create a custom template.
Here’s how to create a custom post type archive page in WordPress.
Enable Archive for Your Custom Post Type in WordPress
Before creating and using the custom post type archive page, make sure your custom post type has archive functionality enabled.
For example, if your custom post type is called movies and you have SEO-friendly permalinks enabled, your post type archive will be labeled as:
If you see a 404 error page, then your post type doesn’t have archive functionality enabled.
If you used a plugin to create your custom post type, you can edit it and enable the archive functionality there.
For example, in the CPT UI plugin, you can edit your custom post type and turn on the ‘Has Archive’ option under post type settings.
If you used code to create your custom post type, you’ll need to edit that code to enable archives. Here’s a short example of the code:
function create_post_type() {
register_post_type( ‘movies’,
array(
‘labels’ => array(
‘name’ => __( ‘Movies’ ),
‘singular_name’ => __( ‘Movie’ )
),
‘public’ => true,
‘has_archive’ => true,
)
);
}
After adding has_archive
functionality, you’ll see your custom post type archive page instead of a WordPress error.
Customizing Your Custom Post Type Archive Page
For some users, the default archive template is fine. It lists all items under your custom post type.
However, some users may want to change it to look different from blog and other archive pages.
You can do this by adding a custom template for your custom post type to your WordPress theme.
First, connect to your WordPress website using an FTP client or the File Manager in your hosting control panel.
Navigate to the /wp-content/themes/your-current-theme/
folder and download the archive.php
file to your computer.
Rename the file to archive-{posttype}.php
, where {posttype}
is the name of your custom post type. For example, if your custom post type is called movies, rename it to archive-movie.php
.
Open this file in a plain text editor like Notepad to make changes.
This file already contains the code needed to display the custom post type content. You can add or change the layout of the existing template.
Once satisfied with your changes, save the file and upload it to your WordPress theme folder.
Visit your custom post type archive page to see your changes.
Create a Custom Post Type Archive Page Using SeedProd
For this method, we will use SeedProd. It’s a page builder plugin that lets you create custom pages for your site easily.
SeedProd has a drag-and-drop interface, so you can design your custom post type page without writing any code. You can also use SeedProd to design other pages or create a custom theme from scratch.
First, install and activate the SeedProd plugin. Follow our guide on how to install a WordPress plugin.
After activation, enter your SeedProd license key, which you can find in your SeedProd account.
Go to SeedProd » Landing Pages and click the ‘Add New Landing Page’ button.
Choose a template for your page. You can use a template similar to your website design or start with a blank one.
Provide a name for your page and choose a URL that represents your custom post type.
This takes you to the page builder interface. Choose a layout and start adding blocks from the left column.
Start by adding the Posts block to display items from your custom post type. Drag and drop the Posts block from the Advanced section onto your page.
By default, the posts block displays your blog posts. Click on the block settings and select your post type from the Query by Post Type section.
Review other options to turn on the featured image, change the excerpt size, and more.
Switch to the Sections tab and add a header or footer to your page layout.
Once done editing, publish your page by clicking the dropdown arrow next to the Save button and selecting ‘Publish’.
Visit your custom page by clicking the preview tab to see it in action.
Here is what our custom post type archive page looks like on our test site.