Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

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.

share|improve this answer
    
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). –  Mariano Grandioso Feb 4 '13 at 11:47
add comment
up vote 0 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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