How to Create a Custom Post Types Archive Page in WordPress

Do you want to create a custom post type archive page in WordPress?

Normally, custom post types in WordPress would use your theme’s archive template. You can also create your own custom archive page for your post types.

In this article, we’ll show you how to easily create custom post types archive page in WordPress.

What is a Custom Post Type Archive Page in WordPress?

A custom post type archive page is where users can view all items filed under a particular custom post type.

By default, WordPress comes with two commonly used post types called Posts and Pages. WordPress plugins may also create their own post types.

For instance, WooCommerce adds a new post type called Products to your WordPress website.

Similarly, you can also create custom post types and use them to manage different types of content.

After creating your custom post type, you can use it inside the WordPress admin area. However, your WordPress theme is responsible for displaying all your content.

If your theme doesn’t have a template for a particular post type, then WordPress will use the default archive template to display any post type archive page.

Archives page for a custom post type

To learn more, see our guide on WordPress template hierarchy and how to use them in your WordPress theme.

Now if you want to make changes to how your custom post type archive page is displayed, then you can do so by creating a custom template.

That being said, let’s take a look at how to easily create a custom post type archive page in WordPress.

Enable Archive for Your Custom Post Type in WordPress

Before you can create and use the custom post type archive page, first make sure that your custom post type has archive functionality enabled.

For instance, if your custom post type is called movies and you have SEO friendly permalinks enabled, then your post type archive will be located

https://example.com/movies

If you see a 404 error page when visiting this page, then your post type doesn’t have archive functionality enabled.

404 error for custom post type archive page

Now, if you used a plugin to generate your custom post type, then you can simply edit it in there and enable the archive functionality.

For instance, in CPT UI plugin, you can edit your custom post type and turn on the ‘Has Archive’ functionality under post type settings.

CPT UI turn on archive

On the other hand, if you used code to generate your custom post type, then you’ll need to edit that code to enable archives.

Following is a short example of the code to generate a post type. You can see the last line has an additional attribute to enable archive pages.

12345678910111213add_action( 'init', 'create_post_type');functioncreate_post_type() {    register_post_type( 'movies',        array(            'labels'=> array(                'name'=> __( 'Movies'),                'singular_name'=> __( 'Movie')            ),        'public'=> true,        'has_archive'=> true,        )    );}

Hosted with ❤️ by WPCode

1-click Use in WordPress

After adding has_archive functionality, you would be able to see your custom post type archive page instead of getting a WordPress error.

Customizing Your Custom Post Type Archive Page

For some users, the default archive template would do just fine. It would list all items you published under your custom post type.

However, some users may want to change it a bit so that it looks different from your blog archive and other archive pages.

You can do that by adding a custom template for your custom post type to your WordPress theme.

First, you need to connect to your WordPress website using an FTP client or via the File Manager app in your hosting control panel.

Once connected, you need to navigate to the /wp-content/themes/your-current-theme/ folder.

Download archive template

From here, you need to download the archive.php file to your computer.

Once downloaded, you need to rename the file to archive-{posttype}.php where {posttype} is the name of your custom post type.

For instance, if your custom post type is called movies, then you’ll need to rename it to archive-movie.php.

Rename archive template

You can now open this file using any plain text editor like Notepad to make any changes.

This file already contains all the code needed to display the custom post type content. You can add any code that you want to add or change the layout of existing template.

Tip: If you need help, then see our WordPress theme development cheat sheet for beginners.

Once you are satisfied with your changes, don’t forget to save the file.

After that, you need to upload this file to your WordPress theme folder using the FTP or File Manager app.

You can now visit your custom post type archive page to see your changes in action.

Custom archive template preview

Create a Custom Post Type Archive Page Using SeedProd

For this method, we will be using SeedProd. It is the best WordPress page builder plugin on the market and allows you to easily create custom pages for your website.

It comes with a drag and drop interface that allows you to easily design your custom post type page without writing any code. You can also use SeedProd to design other pages on your website, or even create a custom theme from scratch.

First, you need to install and activate the SeedProd plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to enter your SeedProd license key. You can find this information under your account on the SeedProd website.

SeedProd license key

Next, you need to go to SeedProd » Landing Pages.

From here, click on the Add New Landing Page button to get started.

Add new landing page

Next, you need to choose a template for your page.

If there is a template similar to your website design, then you can use that or start with a blank template.

Choose template

Next, you need to provide a name for your page and choose a URL.

Make sure you use something that represents your custom post type.

page name and URL

This will take you to the page builder interface.

You can choose a layout to start with and then start adding blocks from the left column.

Page builder user interface

Let’s start by adding the Posts block to display items from your custom post type.

Simply drag and drop the Posts block in the Advanced section onto your page.

Add posts block

By default, the posts block will display your blog posts.

Click on the block settings and then select your post type under Query by Post Type section.

Select post type

After that, you can review other options to turn on featured image, change excerpt size, and more.

When you’re finished with the post block settings, you can switch to the Sections tab and add a header or footer to your page layout.

Edit your post type page

Once you’re done editing, you can go ahead and publish your page.

Simple click on the dropdown arrow next to the Save button and select Publish.

Publish your custom page

You can now visit your custom page by clicking on the preview tab to see it in action.

Here is what our custom post type archive page looks like on our test site.

Custom archive page template created with SeedProd

You can now add this page to your navigation menu, or continue editing to optimize it further.

Examples of Custom Post Type Archive Pages

Using a custom template for your post type archive page allows you to customize it to fit your needs.

For instance, you can remove the sidebar, change the layout of the page, and provide more context to make the archive page more engaging.

Following are a few examples of custom post type archive pages with their own custom templates.

WPBeginner Deals page is a custom post type which is using its own archive template.

Custom post type archive page example - WPBeginner Deals

We also use a custom template for our WordPress Glossary section which is also a custom post type.

Glossary page using a custom post type archive page

Our friends at MemberPress use a custom post type archive template for their addons section.

MemberPress addons custom post type

We hope this article helped you learn how to easily create a custom post type archive page. You may also want to see our guide on how to start your own podcast, or our expert comparison of the best business VoIP providers.

Do you want to create a custom post type archive page in WordPress? Normally, custom post types in WordPress would use your theme’s archive template. You can also create your own custom archive page for your post types. In this article, we’ll show you how to easily create custom post…

Do you want to create a custom post type archive page in WordPress? Normally, custom post types in WordPress would use your theme’s archive template. You can also create your own custom archive page for your post types. In this article, we’ll show you how to easily create custom post…

Leave a Reply

Your email address will not be published. Required fields are marked *