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'm currently working with the 2010 theme and want to modify the nav bar so that when you click on a page that is listed on the navbar, it takes you to one of my categories pages (example, clicking on 'swag', will take you to the swag category page). How would I go about doing this? I've included my website:

http://www.bro-campus.com

Here is the code that deals w/ the navbar:

<?php /* Our navigation menu.  If one isn't filled out, wp_nav_menu falls back to wp_page_menu.  The menu assiged to the primary position is the one used.  If none is assigned, the menu with the lowest ID is used.  */ ?>
            <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
        </div><!-- #access -->

Thanks for the help.

share|improve this question
add comment

migrated from stackoverflow.com Jun 26 '11 at 23:48

This question came from our site for professional and enthusiast programmers.

2 Answers

Posting this as a separate answer, because it's actually different from @Keoki Zee's answer.

You do need to create a custom menu, but you do not need to use a custom link.

  1. Go to Dashboard -> Appearance -> Menus
  2. If necessary, Create a new menu
  3. Add whatever Pages to the menu that you want
  4. To add a Category, ensure that the appropriate metabox is available:

    4.1. Click Screen Options

    4.2. Ensure that the Categories is enabled (checked)

  5. In the Categories metabox, select the Categories that you want to add to your menu, then click Add To Menu

  6. Save the menu
  7. Add the Menu to the appropriate Theme Location, in the metabox in the upper left-hand corner, titled Theme Locations
share|improve this answer
add comment

You shouldn't need to modify the php code to do this, you can set up a custom link in the menu through the wordpress admin, and have it point to the url of your category page.

Specifically, follow these steps in the admin interface:

  1. Go to Apperance.
  2. Click Menus.
  3. Under Custom Links, enter the URL of your category page, as well as the label for the link.
  4. Click Add to Menu.

That should do it.

Menus Custom Links

share|improve this answer
    
I tried this menu, but it requires that I create a new menu first. Do I need to do this? –  TopChef Jun 26 '11 at 22:45
    
@TopChef I actually don't remember whether or not you need to create a new menu to use custom links, but if you do, it's easy to fill the new menu in with the links you already have, and you can set it to automatically add top-level pages for you. –  Cupcake Jun 26 '11 at 22:49
add comment

Your Answer

 
discard

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