1

I can add categories, I can even add a custom post type archive, but I can't add the original posts archive.

It's not among the page list.

I worked around this by creating a page, creating a page-pagename.php file, displaying the posts there and linking to that page, but when that page is shown, the menu item doesn't have the 'current-menu-item' class.

2 Answers 2

1

If you don't have static front page

Since you can add a custom post type archive, then just specify post_type=post.

If you have static front page

Go to Settings -> Reading and specify posts page you've created as Posts page from dropdown. Now all necessary classes will be added to Nav Menu — current-menu-item, current-menu-parent, current_page_item, current_page_parent among others.

Be sure to create custom template for this page. Otherwise it will utilize page.php template file. You can alter a copy of category.php.

1
  • Unfortunately I can't specify the post type when adding an item to the menu. I use a plug-in for that. I tried to look into the code, but I couldn't fix it. I do have a static front page, but it's not the page with the posts I'm trying to stick into the menu. I set the front page to the News page, but now the news page turns up empty (I have both a page-news.php and an archive.php template). Feb 4, 2013 at 11:47
0

Instead of finding out how to put a custom archive link in the menu (which would still be nice to know), I found the problem with my custom page template solution.

To display the posts in the News page template I obviously had to alter the original query, which carried the News page record. Since the footer, which was outputting the menu, only came after the loop, it couldn't find out which page it was on - hence it couldn't correctly assign the current-menu-item class.

All it took was a wp_reset_query(); command after the custom loop and we're good.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.