How to Add Post Type Archive in WordPress Navigation Menus
Recently, one of our readers asked if it was possible to add a link to custom post type archive pages in WordPress navigation menus. An archive page in WordPress displays a list of all posts under a specific post type, category, or tag. In this article, we will show you how to add post type archive in WordPress navigation menus.
Custom Post Type Archives in WordPress
In WordPress, the term ‘Archives’ is used for a list of entries from a post type or taxonomy (like categories and tags).
If archives are enabled for a custom post type, then you can display them on your website. Typically, the URL of your custom post type archive page is in this format:
http://example.com/post-type-slug/
Post type slug is the nice name for your custom post type.
For example, we have a custom post type called ‘Deals’, and you can view its archive page at a URL like this:
http://www.wpbeginner.com/deals/
You can place a link to the archive page of your custom post type in your site’s navigation menus. This will allow your users to see all past entries posted in that post type on a single page.
Having said that, let’s see how to add a link to your custom post type archive page in WordPress navigation menus.
Adding Link to Custom Post Type Archive page in Navigation Menus
First, you need to visit Appearance » Menus page. You will notice a tab for each of your custom post type in the left column.
You need to click on the name of your custom post type to expand it and then click on the ‘View all’ tab.
You will see an option for your post type archives. Check the box next to it and then click on the Add to Menu button.
Your custom post type archive will now appear as a menu item in the right column.
By default, it will use your custom post type name with the word archives for the link label.
You may want to change this into something easier. Click on the menu item to edit it and then change its navigation label.
Don’t forget to click on the save menu button to store your changes.
You can now visit your website to see the custom post type archive link in your navigation menu.
Just like posts and pages, you can also add a single entry from your post type to navigation menus.
Simply select an entry and then click on add to menu button.
Don’t forget to click on the save menu button to store your changes.
My Custom Post Type Doesn’t Appear on Menus Screen
Custom post types need to match some requirements in order to be displayed on Appearance » Menus page.
First you need to make sure that an archive page exists for your custom post type. Typically it is a URL like this:
http://example.com/movies/
Replace example.com with your own domain name and movies with your post type.
If you can see entries from your post type on this page, then this means your post type supports archives but does not support other requirements.
Good news is that you can still add your custom post type archive page as a custom link.
Visit Appearance » Menus page and then click on the ‘Custom Link’ tab to expand it.
Enter the URL of your custom post type archive page in the URL field and add the label you want to display in the link field.
Next, click on the add to menu button, and you will notice the custom link appear in the right column.
You can now click on the save menu button to store your changes.
We hope this article helped you learn how to add post type archive in WordPress navigation menus. You may also want to see our list of 12 most useful WordPress custom post types tutorials.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
The post How to Add Post Type Archive in WordPress Navigation Menus appeared first on WPBeginner.
source http://www.wpbeginner.com/wp-tutorials/how-to-add-post-type-archive-in-wordpress-navigation-menus/