I have 4 custom post types set up in my blog and video is one of them. I want the video archives page (archives-video.php) to shop up in my primary navigation.
how do I do this without writing a custom function?
I have 4 custom post types set up in my blog and video is one of them. I want the video archives page (archives-video.php) to shop up in my primary navigation.
how do I do this without writing a custom function?
You must be logged in to post a comment.
Straight from the WordPress documentation for registering_post_type in the code you are registering your custom post type you should be able to add: ‘show_in_nav_menus’ => true, and that should allow your post type to show in navigation menus. Here’s the documentation for the register_post_type function
Adding a link in your menu straight to the page also works, but in my opinion it is very messy. It would seem not many people are aware of the show_in_nav_menus argument of register_post_type because by default the value is set to false.
Hope this helps you.
In absence of further context from you, I would advise that you create a WordPress menu and simply add a link to your custom post type’s archive page.
Amit,
WordPress (3.2) does not currently provide a way for you to add custom post type archive page into the navigation. One way to do it would to create a page with a slug that matches the slug of your post type archive page. This page will just be a placeholder so the archive page shows up in your navigation.
For example, if, when registering your video CPT, you set has_archive => ‘videos’, create a page called ‘Videos’.
Videos will now show up in your navigation and when /videos/ is requested, users will get the videos CPT archive page and not the Videos page because of the order of the rewrite rules that WordPress creates.