361 Responses

  1. Ryan
    Ryan Published |

    Another excellent article as always! Thanks Justin :)

    Reply
  2. Jean-Baptiste Jung
    Jean-Baptiste Jung Published |

    Excellent post. Thanks!

    Reply
  3. Michelle
    Michelle Published |

    Thanks for the tutorial, it’s very helpful for me!

    Reply
  4. Matt Orley of the Remarkable Team

    Hooray can’t wait! This and new post templates will certainly convince me to utilize Wordpress more than Joomla moving forward. The world is changing so fast and so GOOOD for web developers! Matthew Orley, Peninsula, OH

    Reply
    1. Bruno Brant
      Bruno Brant Published |

      “The world is changing so fast and so GOOOD for web developers!”

      I would say: “The WORD is changing so fast and so GOOOD for web developers!” =)

      Reply
  5. testbeta
    testbeta Published |

    thanks for the write up Justin!

    was the new theme Twenty Ten based on similar theme as justinadlock.com is? or justintadlock.com using the twenty ten?

    Reply
  6. Jinnat Ul Hasan
    Jinnat Ul Hasan Published |

    Thanks Justin to round-up the menu system. WordPress 3.0 menu system just looks amazing.

    Reply
  7. Andrew Nacin
    Andrew Nacin Published |

    Hi Justin,

    I like is_nav_menu_active() and we’re likely going to add it to core. Do you think you could prefix it in your tutorial?

    Also, get_nav_menu_locations() returns an array in the form of $locations[$location] => $menu_id, so the the argument should be $location instead of $menu.

    We recognize that the terminology used in function names may be confusing at first, as a theme registers a “nav menu” but really you’re just registering a location. If you have any suggestions, let us know.

    Nacin

    Reply
  8. Andrew Nacin
    Andrew Nacin Published |

    After bouncing around a few ideas, looks like we’re going to go with has_nav_menu( $location ). You’ll see it in trunk soon.

    Reply
    1. Andrew Nacin
      Andrew Nacin Published |
      Reply
  9. Jeff Starr
    Jeff Starr Published |

    Superb!

    Incredible work once again, Justin :)

    Reply
  10. Chris Creed
    Chris Creed Published |

    Cheers Justin for the thorough review – I also get lots of support requests about creating custom menus, so this new update is going to make things much easier.

    Reply
  11. Lucian
    Lucian Published |

    Hey Justin, that’s a really detailed article that will help many for sure.
    I have a question though. Do you think is possible to show sub-pages only for the current parent page, in the sidebar for example. The sub-pages for the other parents will colapse.

    I wrote an article about this method, but it needs an outdated plugin to work and is not tweaked to work for categories.
    http://bit.ly/csLd4L

    Some insight on this would be appreciated by community as it is very popular in larger websites navigation.

    Reply
    1. Saulyz
      Saulyz Published |

      This is exactly what I’m looking for quite a long time.

      Reply
  12. Sawyer
    Sawyer Published |

    Great overview, this will be very helpful!

    Reply
  13. Justin Tadlock On Menus In WP 3.0
    Justin Tadlock On Menus In WP 3.0 at |
  14. Jeffro
    Jeffro Published |

    Hey Justin, we have sidebars for widgets and we can drag widgets around to rearrange them. What are the areas called that house menus? Simply nav containers? Or Navigational sidebars? Also, is there any similarity between the widget system and how menus work outside of rearranging stuff?

    Reply
  15. paul
    paul Published |

    very detailed tutorial. I’ll bookmark it for the future.

    thanks Justin

    Reply
  16. Mike Smith
    Mike Smith Published |

    Awesome article Justin. Very, very detailed. I’ve saved it to delicious, shared it via twitter and am going to go over all of this for my themes. I’ve got the basics down for the menus, but this is definitely a step up from where I am at right now with them.

    Reply
  17. Goodbye, headaches. Hello, menus! | WPLover
  18. Kel
    Kel Published |

    Great writeup! Of course, if you don’t see it coming, let me be the first to offer: Child Menus – It could happen :)

    Reply
  19. Jörn
    Jörn Published |

    It seems like the new has_nav_menu still has problems after menus are deleted. On my test blog the function return true although no menus are left. I already filed a ticket at the Trac.

    Reply
    1. Andrew Nacin
      Andrew Nacin Published |

      I’ve since closed your ticket with a fix. :-)

      Reply
  20. Goodbye, headaches. Hello, menus! « Blog do Gabriel
  21. Andrew
    Andrew Published |

    Great tutorial! This deserves to be bookmarked because it is really helpful in a lot of ways.

    Reply
  22. Today in WordPress world – 01/06 | Links | WereWP
  23. Rilwis
    Rilwis Published |

    Wonderful article. All information about the new menu system is gathered here. Thanks for sharing.

    Reply
  24. cehwitham
    cehwitham Published |

    I’m using 3.0-RC1-15092.

    I currently have the follwoing options for menu items:

    * URL
    * Navigation Label
    * Title Attribute

    I don’t have the following that are shown in your screenshot:

    * CSS Classes
    * Link Relationship (XFN)
    * Description
    * Link Target (Please note that a kitten dies every time a link is opened in a new window/tab.)

    CSS Classes would be amazingly useful. Do I have to turn this functionality on or is it not available in my release?

    Really helpful post.

    Reply
    1. kucrut
      kucrut Published |

      they’re hidden in the ‘Screen Options’ :)

      Reply
      1. Global_1981
        Global_1981 Published |

        Awesome thanks saved me a lot of frustration!

      2. kevin
        kevin Published |

        Same as Global and Markgt, thanks!

    2. Markgt
      Markgt Published |

      Thanks @kucrut for that tip! been looking all over for that :)

      Reply
  25. cehwitham
    cehwitham Published |

    Just found that I can turn these options on using the Screen Options panel.

    Many thanks.

    Reply
  26. Justin has a nice theme developer orient… « WordPress Development Updates
  27. Jörn
    Jörn Published |

    Thanks Justin for your ongoing work and help.

    Your theme framework hybrid is great. I read about your article about the small things that matter and I found tons of those fantastic small details inside your theme.

    Everytime I wanted to add new functionality to my own theme I found that you already implemented this in hybrid.

    I hope you don’t mind, that I added some code to the new version of my theme. I really liked the way you named your hooks and I thought it is a good decision not to reinvent the wheel again (who wants to have square wheels when he can have round ones).

    Your site is already inside my readme.html inside the themes folder and I won’t stop to praise your knowledge.

    Reply
  28. Template Changes/Tags for Wordpress 3.0
  29. kucrut
    kucrut Published |

    Just found out that it’s kind of impossible to get a valid markup with the current implementation of wp_nav_menu. If you try to add the same item (eg. page) to more than one menu and display those menus on the same page, you’ll get duplicate IDs.

    Is there any workaround for this or could this be considered as a bug?

    Reply
  30. Christian Zumbrunnen
    Christian Zumbrunnen Published |

    Fantastic post. Thanks for your clear, understandable, tutorial-like information.
    It helps a lot in understanding WP-menus.

    Reply
  31. Carlos
    Carlos Published |

    Thanks for the tutorial, looks like you got all the “How-To´s” for menus in WP3.0 down in one post-excellent!

    Not too sure about the Kittens Dying though – personally speaking I prefer it when a link opens in a new tab.

    Reply
    1. Saskia
      Saskia Published |

      Yes.. personally spoken.

      However you can always achieve to open a link via rightclick > Open link in new tab/ Open link in new window/etc.

      I for myself agree 100% with the author that one should never “litter” the user’s screen with a bunch of new probably unwanted tabs or windows just because he was clicking several links on your site.
      Do you maybe know the reason why people install tools like “AdBlock”? If, you do, then you might understand why kittens die on the new tab and window forcement.

      Hugs
      Sas

      p.s. Sorry for my bad english.. not native language

      Reply
  32. Arnoud
    Arnoud Published |

    This is indeed a very nice 3.0 feature. I’m working on this at the moment.
    Does anyone know how to show only the childs of the active parent, for instance in the sidebar?

    [mainmenu] = only level 1 items
    [submenu] = only show level 2 of specific level 1 parent

    I’ve been looking al over for this, but can’t seem to find it.
    It should be possible, since it was possible with ‘wp_list_pages’.

    Hope someone can help me out!

    Reply
  33. Dr. Lawrence Kindo
    Dr. Lawrence Kindo Published |

    I was trying to tinker with the menu system in the wordpress dashboard and was quite thrilled about the output. Simple for the user but a tad bit of hard work for those behind wordpress 3.0. Welcoming the new version of wordpress!! Cheerios!

    I really like how you have elaborated on the menu system in the new wordpress.

    Reply
  34. Webbhotell
    Webbhotell Published |

    Excellent post again Justin

    This is awesome feature and there’s so many other cool features upcoming so i really hope Wordpress 3.0 os being released soon.

    Reply
  35. Steve
    Steve Published |

    2.9.2 works perfectly fine. Little in the new package has any useful value for us.

    Reply
    1. James
      James Published |

      And never mind the new features that streamline development and save countless hours of hacking, or the fact that with this release WordPress can finally be called a CMS out of the box.

      Reply
    2. Mark
      Mark Published |

      And just to dog pile Mr. Steve a little bit further…

      Mr. Steve: Please do NOT use the word us when expressing something which is solely your own opinion—especially when it’s an unpopular one. Thanks!

      Reply
  36. Philip
    Philip Published |

    Thanks Justin, I’m a Wordpress newbie but confident that with resources available like this I can only keep improving. I’m particularly interested in the collapsible menus but probably need to focus more on some of the basics first. I’ll be vistiting again!

    Reply
  37. Webnews #12: Greek, Kiss, Tokyo & SEO | Andi Licious' Blogosphäre
  38. James
    James Published |

    One thing I’d love to be able to do is use the description text you can define for each link and have it rendered inside a span tag within the link. So far no luck at all. Has anyone else succeeded with this?

    Also on the version of 3.0 I’m playing with, using using “after” as an array puts text after the entire link, not within it but after the link text.

    Reply
  39. Peter
    Peter Published |

    Thanks Justin, I’m just looking at how best to implement v3 menus so this post is timely and very much appreciated..

    Reply
  40. Kenneth Younger
    Kenneth Younger Published |

    How you are getting the #primary-menu CSS ID to show up? All I’ve been able to get working there is class names.

    Reply
  41. Daily Digest for June 5th
    Daily Digest for June 5th at |
  42. Kevinjohn Gallagher
    Kevinjohn Gallagher Published |

    Hi Justin,

    Thanks for this great preview.
    I’m wondering if you happen to have seen any examples of the following:

    1) A “Walker” class

    Its great being able to call one, but if we could see one in action or a tutorial anywhere or on the codex, it would make life alot easier.

    2) The ability to call certain levels of a menu separately/specifically

    When using “wp_list_pages( $args );” we can specify DEPTH and CHILD OF.

    Effectively allowing us to call out a sub menu for display somewhere else.

    I’m confident both of these are around somewhere, i’m sorry, i just can’t find any info on them myself. I’d appreciate any information anyone has.

    Thanks
    Kev

    Reply
  43. WordPress 3.0 Features – Every Theme Developer Should Know
  44. Hover
    Hover Published |

    Fantastic!

    Very much looking forward to WordPress 3.0!

    Reply
  45. Best On WordPress From The Past Week N.9 » wpCanyon
  46. Weekend Roundup #86
    Weekend Roundup #86 at |
  47. Ads
    Ads Published |

    Not sure if anyone else has had issues with register_nav_menus() and wp_nav_menu() or not but here’s my rant…

    In my functions.php i have:

    register_nav_menus(array('global' => __('Global')));

    in my header.php i have:

     'global')); ?>

    And i have the menu set to the appropriate location in the admin dashboard.

    My issue is that i do not get the child pages rendered out to the page. The ul/li combo is only for top level pages only. Even if i use 'depth' => 3 in the wp_nav_menu arg array it still fails to show children.

    Any ideas? I’m using 3.0-RC2-15161

    Thanks.

    Reply
  48. Ads
    Ads Published |

    Sorry, my previous post should have read…

    in my header.php i have:

    wp_nav_menu(array('theme_location' => 'global'));
    Reply
  49. WordPress 3.0: What’s new - op111.net
  50. Where did the Spring Go? WP3, Menus & jQuery - TrinityDC Web Guy - Trinity Washington University
  51. Timothy
    Timothy Published |

    This is fantastic, thanks!

    Two questions for anybody generous enough to respond:
    1) I want to use accordion menus, where the accordion ‘tabs’ are UI only, and do not link to anything – just click and the menu’s sub-items fold out. Any better way to do this using the menu system than to create blank top-level pages or setting the URL of these menu items to ‘#’?
    2) Is there a way to promote the menus option to a top-level item in the admin area? I would like most users to be able to modify the menus (WP working as a CMS in this case), but I do not want them to see all the Appearance options.

    Thanks again for a fantastic explainer for this new feature!

    Reply
  52. Ed Nailor
    Ed Nailor Published |

    Playing with WP 3.0 RC1, I found that when adding a Custom Post Type, I was able to include these on the new Menu, which was very cool. However, since then, I have started the site I was working on with a fresh database (dropped the database tables) and now the Custom Post Type items aren’t available for my new Menu. Everything seems to be the same, so I am sure I have missed some step somewhere. Do you have any insight on this?
    Ed

    Reply
  53. Aurel Wong
    Aurel Wong Published |

    Hi Justin,

    I am glad to find your blog.
    I believe your blog will help me to improve my blogging skill .
    Thank you.

    Regard,
    Aurel Wong

    Reply
  54. Ed Nailor
    Ed Nailor Published |

    OMG! I just found this… I knew I wasn’t loosing it!

    When you are on the Custom Menu page in the admin, clicking on the Screen Options in the top right corner allow you to include more options with your Custom Menus. Included in this was a checkbox for my new Custom Post Type, along with Posts, Link Targets, CSS classes and descriptions!

    NOW THAT IS COOL!

    Reply
  55. Johnnie
    Johnnie Published |

    Hi guys, what options are available for the ‘fallback_cb’ =>” function?
    I would like my sub-menu to load up if no menu found instead of “wp_page_menu”

    Thanks!

    Reply
    1. James Tryon
      James Tryon Published |

      Im looking to do the same thing. Did you get this to work?

      Im using a child theme of twenty ten.

      Reply
  56. New Menu Navigation System in WordPress 3.0 | I'd Rather Be Writing - Tom Johnson
  57. Mel
    Mel Published |

    I’m glad that nav menus are being addressed. A welcome upgrade.

    Reply
  58. Lonny
    Lonny Published |

    The only think I don’t like about Justin Tadlock is that he doesn’t publish WordPress 3.0 stuff every day of the week. Because when he does, it is well thought out and documented.

    Too bad WP is open-source, else Ma.tt ought to hire Justin to do the WP documentation.

    Reply
  59. Adam
    Adam Published |

    I am so glad I found this site months ago. I have been experimenting with a lot of different tricks from justin and they are working great. Thanks J

    Reply
  60. Lox
    Lox Published |

    Don’t be to exited about the new menu system. It is is intentionally incomplete.

    For example there is NO filter to filter the generated array of menus items. So, say goodbye to sub-menu and portions of menu display, you won’t be able to do it with a powerful wordpress filter.

    Why? Because the wordpress dev team has refused to include ONE more line of code and delayed it to WP 3.1.

    Reply
  61. NightMan
    NightMan Published |

    Hello everyone!

    Is it possible add link to home page? I use multilanguage plugin and have 2 home pages (“/” and “/ru/”), so I can not add link with static URL… all working very good with pages and categories, but I also need home page link :)

    Reply
    1. Glenn
      Glenn Published |

      This has been added since the release of 3.0, but it’s a bit hidden. In the new ‘Menus’ section of WP, click the ‘View All’ tab on the ‘Pages’ box. You should see a checkbox for ‘Home’.

      Reply
  62. cristiana
    cristiana Published |

    My website is based on wordpress them. I need to add this.Thanks man

    Reply
  63. Benjamin Knight
    Benjamin Knight Published |

    I’m wondering if it’s recommended to use this new feature to control a site’s main navigation menu or only for creating smaller, secondary menus. I would imagine it is since nobody wants to use plugins or forwarding if they want to have links to non-pages such as category indexes or other sites. When creating a main navigation menu then, it would be nice then if there were a way to select all pages and add them to a menu such that their order and parent/child structure were preserved.

    Other than that, all praise to the WordPress development team for a great new feature!

    Reply
  64. Johan
    Johan Published |

    Is there a way to get the “Menu name” in the same fashion you use title_li= with wp_list_pages() …

    Or you will have to use Static name above the menu.

    For example a sidebar menu.

    Reply
  65. Kyle
    Kyle Published |

    Anyone have any idea on how to do a quick export/import of custom menus?
    I’m using a framework for multiple sites and it would be nice to do an easy import/export for each site instead of recreating them each time.

    Thanks,
    ~Kyle~

    Reply
    1. Marc
      Marc Published |

      @kyle – Did you find a plan for this? I’m looking for the same functionality. Thanks.

      Reply
    2. Marc
      Marc Published |

      This would be especially great for complex/long menus/navigations.

      Reply
  66. stephan
    stephan Published |

    Hey Justin,

    thanks for this great article and overview. I tried to use theese functions for my template but I got the issue, that the wordpress won’t save the assigments I create in the admin panel. After choosing which menu is located in the theme and pressing save, everything seems all right, but on the site he simply shows the menu with the lowest ID. After refreshing the apperance/menu site the assigment is lost again. When I use the twentyten theme it works nicely and I can not figure out my misstake. Any suggestions?

    Im running WP3.0 RC3 and here is my code:

    http://nopaste.php-q.net/296509

    thanks and best regards
    stephan

    Reply
  67. Wordpress 3.0 Roundup | Themergency
    Wordpress 3.0 Roundup | Themergency at |
  68. WordPress 3.0 Theme Development Links | WPLover
  69. Leo
    Leo Published |

    Thanks for the post, but one problem that I notice or unless I am doing something wrong is that a custom created link doesn’t get the current-menu-item class if it is the active link.

    Anyone else experience this?

    Reply
    1. Justin
      Justin Published |

      I had the same issue – it definitely needs the trailing slash.

      I’m wondering how to have this home link work across servers (dev, staging, live) and still get the current-menu-item option. If I use just “/” it doesn’t get the class at all. Anyone have experience with this?

      Great tutorial (and name) Justin!

      Reply
      1. Justin
        Justin Published |

        For now, I left the custom home link as “/” only and added a class to it to give it the same property as the current-menu-link class when on the home page. Works locally and live without having to update the link

  70. Cancasa
    Cancasa Published |

    Can’t wait until I start using this enhancement.

    Reply
  71. Govindji Patel
    Govindji Patel Published |

    I just upgraded to 3.0 and I do not have Menus in Appearance menu is there anything I need to do to get it there.

    Reply
    1. ColtonCat
      ColtonCat Published |

      Maybe you should actually read this post, that is what it explains.

      Reply
  72. Around the WordPress Community: June 18th, 2010 | WordCast - WordPress podcast, Blogging podcast, Blogging news, WordPress plugins, WordPress themes, WordPress news
  73. links for 2010-06-18 (Jarrett House North)
  74. Josh
    Josh Published |

    Thanks for the article. Have you been able to figure out how to display things like the custom description?

    Reply
  75. How to add support for navigation menus to your WordPress theme
  76. Practical Theme Support For WordPress 3.0 Menus
  77. Troy
    Troy Published |

    Hi Justin,

    I am wondering if you know why I am now longer able to add my single posts to the nav bar. Is there a support function I need to add for this now. It works in the beta versions. I have my featured image showing in the navigation via the nav-menu-template.php file. Since posts are no longer supported the functionality stopped working. When I add a custom link it also doesnt work. Is there a quick fix or support function for this, or do you have any ideas for an alternative way to show the featured image from a custom link added in the nav. Thanks very much

    Troy

    Reply
  78. Troy
    Troy Published |

    I should have read for a minute longer. Thanks Ed.

    Ed Nailor
    June 8, 2010 at 2:27 pm | Permalink | Reply
    OMG! I just found this… I knew I wasn’t loosing it!

    When you are on the Custom Menu page in the admin, clicking on the Screen Options in the top right corner allow you to include more options with your Custom Menus. Included in this was a checkbox for my new Custom Post Type, along with Posts, Link Targets, CSS classes and descriptions!

    NOW THAT IS COOL!

    Reply
  79. Dave Immerz
    Dave Immerz Published |

    I’m also experiencing the problem of the ‘current-menu-item’ class not working. I’m not sure if it’s supported using the new menu system as it’s not in the source code?

    Hopefully I’m wrong and someone has a solution…

    Reply
    1. Rich
      Rich Published |

      I had the same thing and it turned out to be a conflicting style from my css. If you can then use FireBug to find out what style is naturally being applied to the unselected navigation items. If its something like this:
      #nav ul li a {}
      then a simple .current-menu-item {} will not work. You have to target it in the same way as the pre-existing style, like this:
      #nav ul li.current-menu-item a {}
      Hope this helps.

      Reply
  80. Darrell
    Darrell Published |

    I think you have the after and link_after (also the before) backwards, but looks like you wrote this in beta, so that could be it. I am using ‘link_after’ = | and my pipe is showing after the text but within the link. >a<Text|>/a< (Hopefully that HTML went through). I use ‘after’ to put my string after and outside the link element.

    Also do you know if you can not show the ‘after’ on the last link? I looks silly as I am trying to using my pipe string as a link delimiter.

    Reply
  81. William Lindley
    William Lindley Published |

    A nightmare to maintain, spaghetti bowl of desynchronization, is what these new menus are. They statically replicate what we already had dynamic widgets for. In database lingo, they violate third normal form.

    Post and page descriptions are computed from the page content AT ADD TIME; if you update a post or page, its description is not updated, so you have to remember to manually edit each menu entry each time you edit something. Adding pages, or changing a page’s Order, or changing a page’s Parent, does not change the menu, you have to manually go replicate all your changes in two places.

    Nor can I find any way to write a widget that creates menu items, like my http://wordpress.org/extend/plugins/hierarchical-pages/ , which would solve the above problems by creating menus on the fly, based on your current page location, the N latest posts, or other inputs.

    In short, the new menus should have been a widget, that could be inserted anywhere, instead of a whole new structure. What a mess.

    Reply
  82. Riccardo
    Riccardo Published |

    I’ve created a user with role set as Editor and he can’t see Appearance->Menus.

    I want that he could edit the Menus.

    How could I let him see the Appearance->Menus button?

    Reply
  83. Jose Random
    Jose Random Published |

    Thanks for the article. I think Wordpress 3.0 is one of the greatest things that ever happened to blogosphere, or even to the world! Hey, I’m not exaggerating. It’s really cool.

    Reply
  84. Maria
    Maria Published |

    Hi, could you give us a tip how to make the submenu horizontal instead of the dropdown? Can’t find any code for that anywhere. Is it possible using tme new 3.0 menus?

    Thanks in advance :)

    Reply
    1. ColtonCat
      ColtonCat Published |

      Just search for superfish or go here Superfish – Suckerfish on Steroids

      Reply
  85. Whiskeyjim
    Whiskeyjim Published |

    First Justin, thanks for being a leader in website development across the Internet. I’m not sure you hear that enough:)

    I’m a little surprised by this first implementation of menus to the Wordpress core, which is long overdue given menu prevalence in website accessibility. And yes, that is a swipe at the Wordpress community.

    Several things seem extraordinarily short sighted. First, The wp_nav_menu() call is inconsistent with the existing wp_page_menu() function. Why is that?

    Second, why not build in automatic inclusion of sub-pages? That alone is going to cause incredible amounts of administrative time and confusion, etc.

    Third, there is no shortcode or other easy, theme independent method to embed the menus in pages and posts. Why not? It would seem this capability is one of the most common needs of end users (witness all the plug-ins), and one of the easiest to implement.

    I’m not ranting, just expressing surprise at the current implementation to one of the gurus of Wordpress, who in my view always develops with vision. Thanks man.

    Reply
  86. HOW TO: Get Up-to-Date on WordPress 3.0
  87. Vincent Klaiber
    Vincent Klaiber Published |

    Thanks, I am upgrading my website for 3.0 right now so it helped out a lot!
    Keep up the good work!

    Reply
  88. Dennis Winter
    Dennis Winter Published |

    Hey Justin,

    THAT is a great article on Wordpress 3.0 and it’s awesome menu management!
    But I’ve got one little question: Has anyone tried to display the “description” attribute? I’m running into heavy problems with it and there is no documentation about it, searched Google up to page 50 but nothing showed up.

    Thanks in advance,
    Dennis

    Reply
  89. Stephen Cronin
    Stephen Cronin Published |

    Hi Justin,

    Absolutely fantastic article as usual.

    However, I think it would be worth you pointing out to your readers that if a) a theme is used by other people and if b) some of those people may be on earlier versions of WordPress, then you really need to check if the register_nav_menu function exists before calling it. Otherwise you get a fatal error. It’s a similar story with wp_nav_menu.

    I’ve written about this in my Practical Theme Support For WordPress 3.0 Menus post, if people want to see how to do it – or maybe you could update this post to mention it?

    Regardless, thanks for an excellent post – this is where I learned how to support menus in the themes I’m working on.

    Reply
  90. scriptygoddess » Blog Archive » New WordPress 3.0 Navigation Menus – What you need to know to get started
  91. Web Solutions and Design - Asteriskr
    Web Solutions and Design - Asteriskr at |
  92. My Six Favorite New Features in WordPress 3.0 « The Smorgasbord of Douglas Bell
  93. Angelia
    Angelia Published |

    Just lost quite a bit of time figuring out a little issue I just came across, and thought this info might come in handy for someone. I have been following and developing with all of the new 3.0 features since they began and have yet to see it mentioned or documented anywhere.

    (note: Justin, it would be great if this info were added to the post where you go over adding custom post types with pre_get_posts )

    If you are using the new nav_menu features, even straight out of the box from twenty ten, and you also have custom post types that you would like to add to the $query to show up conditionally i.e. ( if is_author ), and you run the pre_get_posts function to add them, if you do not include nav_menu_item as one of the post types to return, your navigation menu will no longer show up on, for example in this instance, your authors.php remplate.

    It is important to be aware that nav_menu_item is now a registered core/builtin post type.

    Hope that saves someone else some time lost ;-)

    Reply
    1. nickmorss
      nickmorss Published |

      thanks, the @Angelia ‘nav_menu_item’ was what i needed. Just now to get rid of the Warning: Illegal offset type in isset or empty in /home/public_html/wp/wp-includes/post.php on line 736

      Reply
    2. Derrick Walker
      Derrick Walker Published |

      Thanks Angelia! I have been looking for a solution for my missing custom menu on my category and tag pages. This fixed it.

      Reply
  94. Jasmine Soona
    Jasmine Soona Published |

    Thanks for this! I love tinkering around with the code of Wordpress; totally geeky, but I feel like I get to let out a little bit of creativity on each of my blogs :)

    Reply
  95. Avio karte
    Avio karte Published |

    Hooray!!! This is great news. I will look more into it and probably upgrade.

    Reply
  96. Barrett Golding
    Barrett Golding Published |

    Has anyone figured how to insert a separator, like ” | “, btwn links wp_nav_menu? Adding parameter 'after' => ' | ' results in a trailing pipe:
    Link1 | Link2 | Link3 |

    I could grab menu html before the echo() and do a trim(), but wondering if there’s a mo’ better way?

    (I now see Darrell asked this above, but no harm re-querying.)

    Reply
    1. Rich
      Rich Published |

      You could always do this with classes if there is no current support for this. You could either use ‘li’ separators or ‘background-image’ and position to get the look and feel you need.

      Reply
      1. Rich
        Rich Published |

        Forgot to mention you could use a ‘last-child’ / ‘first-child’ class to avoid displaying the unwanted separator at the beginning or end of your menu. (only as a last resort! please do post up an answer to this if you find one)

  97. Anthony
    Anthony Published |

    How can I use superfish with nav_menu ?

    Reply
  98. Benjamin Knight
    Benjamin Knight Published |

    This interface needs dramatic improvement… it’s really a nightmare to create menus on WP installations that have large, complex page structures. The search function doesn’t appear to work… it appears to be searching page bodies, not titles.

    Reply
  99. New Website Design « Pages From My Head
  100. 10 of the Best Tutorials to Get You Up to Speed With WordPress 3.0
  101. KC
    KC Published |

    I’m making changes to my business’s blog and will definitely pass this on to my developer. I know he had some questions in this area and hopefully this will take care of his confusion. Thanks.

    Reply
  102. marcelo araujo
    marcelo araujo Published |

    hi justin!!
    in the ‘theme_location’ iside php arraya we must change to the same name that exists in the ‘tab’ theme location, or this param id fix, i must remain this text ‘theme_location’. im testing but i have not sucess.
    thanks!

    Reply
  103. gabsy
    gabsy Published |

    Any idea how to get menu item title attribute to be displayed as link_after ? or any other posibilities to have individual link_after text for each menu item ?

    Reply
  104. Will Barker
    Will Barker Published |

    Thanks for this Justin,

    Could you expand on how you have added the sub menu indicators in your example menus? there isn’t a class or markup added to li’s that contain a child list to style, how did you do that? for example, superfish requires a sf-sub-indicator class i think.

    Thanks

    Will

    Reply
  105. ge fanuc series
    ge fanuc series Published |

    Wordpress 3.0 has been great. They really set a standard for keeping updated.

    Reply
  106. Christopher
    Christopher Published |

    Thank you! This was what I needed to start implementing the new menus in my custom theme.

    Reply
  107. Agus Suhanto
    Agus Suhanto Published |

    I’m trying to create WordPress 3 menu programmatically.

    Here is the code that I wrote to make it:

    $menu_id = wp_create_nav_menu('my_menu');
    wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => 'First Menu Item', 'menu-item-url' => 'http://suhanto.net', 'menu-item-status' => 'publish'));

    and now I want to assign the $menu_id to “Primary” navigation location. I already looked into the source code in wp-includes/nav-menu.php and wp-includes/nav-menu-template.php and so far I haven’t found a function that achieves that goal.

    So, do you know how to assign a menu id to “primary” navigation location programmatically in WordPress 3.0?

    Reply
    1. Agus Suhanto
      Agus Suhanto Published |

      Finally I found the answer for my question above. I already wrote the answer here as the answer to my own question in WordPress forum: http://wordpress.org/support/topic/419242?replies=2.

      Reply
  108. Karl B
    Karl B Published |

    Great information.

    I love the idea of this but am unsure how much control of the menu you can do with it. I tried it on a project I am working on where if you are on a ‘book’ single post I need the menu to highlight book and if on ‘blog’ post highlight blog. I cannot see how I would attain this using the menu.
    In 2.9 I would use wp_list_categories and use a function for the highlighting like this: http://paste-it.net/public/o76011d/

    Is this doable with 3.0 menus?

    Thanks,
    Karl

    Reply
  109. Yunus
    Yunus Published |

    Thanks for your good works.

    Reply
  110. Gabriel Tadeu
    Gabriel Tadeu Published |

    Anyone know how ‘description’ works? I cant print with custom menu…

    Reply
  111. mati
    mati Published |

    in “custom url” the menu dont get the “current-menu” class, how in your example – the “home” is show as active?

    (sorry og my english)

    Reply
  112. mati
    mati Published |

    oops… you are right, in custom url – the wp tray to find if it is the currnt page- but in my case it have a little bug! the function tray to compare the “custom url” with $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']

    and in my case I dont gave the slash in my home page custom url – and the result is that it not get the current-menu-item class.

    my wp-home -url: localhost/wordpress
    my custom menu url: localhost/wordpress

    I get open a ticket in wp-trac…

    (sorry of my english)

    Reply
  113. WordPress 3.0 Overview – notes | WordPress Austin
  114. mati
    mati Published |
    Reply
  115. Nikesh
    Nikesh Published |

    hey , justin pretty neat article there , but i kind of am facing a altogether new issue , i want to remove the container itself

    i found something on the wordpress codex

    Removing the Navigation Container

    but cannot seem to figure out how to use it

    Reply
  116. martin
    martin Published |

    Hi, I only want to ask why the new menu system supports only 16 items? Tanks in advance.

    Reply
  117. Matt
    Matt Published |

    I am having trouble just showing children of a section in a sidebar. What can I do just to show the dropdown children in the sidebar? Been looking everywhere, can you help?

    Reply
  118. matt
    matt Published |

    @Barrett Golding

    your li:first-child tidbit is a GODSEND. thanks man.

    cheers!

    Reply
    1. Kevinjohn Gallagher
      Kevinjohn Gallagher Published |

      Hi Matt,

      Just so you know the :first-child selector is a CSS2.1 pseudo-class, and isn’t offically supported in all the browsers. Be careful when relying on them for fancy or vital formatting :)

      Reply
  119. Jennifer
    Jennifer Published |

    This is a great tutorial. It was very helpful. I went nuts adding menus to a theme I’m playing with – what fun!

    One question: do you or anyone know why the menus option might not display on a WordPress 3 installation? The owner installed WP 3.0 and the 3.0 themes now work, but he can’t add menus as there is no “menu” option under appearances. Back to Google I go. :-)

    Reply
  120. Debbie Campbell
    Debbie Campbell Published |

    Great post, very easy to add menu support to my custom theme. Thank you.

    Reply
  121. Pakblogger
    Pakblogger Published |

    I hadn’t heard of this before thanks , this is quite useful.

    Reply
  122. Add WordPress 3.0 Navigation System to Your Site | I'd Rather Be Writing
  123. Jason
    Jason Published |

    With the introduction of Menus in WP 3.0, this has superseded the old codex wp_list_pages(). However, this has brought about a coding problem for the navigation menu when dealing with Private pages.

    Whenever there are Private pages present, the Menus (in Admin >> Appearance) doesn’t list them. This requires a search first before they can be added onto the Menu. Unfortunately, when one’s logged out, the Private pages are still shown on the navigation menu and not hidden.

    I believe it’s something to do with the WP 3.0 codex wp_nav_menu().

    Any ideas to fix this?

    Reply
  124. Mrmist
    Mrmist Published |

    Thanks for putting this information down, it’s helped me to integrate menu support properly.

    Reply
  125. Rem
    Rem Published |

    I’ve seen early screenshoots where you can add “Posts” to menu. But categories and pages are available now.

    Is there any way I can add specific “posts” to menu ? Also Specific page of custom post type? I think there is code for it already in core, but not sure.

    Reply
  126. Benjamin Knight
    Benjamin Knight Published |

    It would be nice if there was a function akin to “get_menu_items” that returns an array of objects for each menu nav item, similar to get_posts or get_pages. This would allow developers to be able to directly access the data which has a plethora of advantages, including more control over display or working with other applications. In the meantime I’ll probably just query the database.

    Reply
  127. Roelof
    Roelof Published |

    Also a great Post… Wordpress 3 is much better than the vers. before.
    Extreme SEO Google Internet Marketing.

    Reply
  128. Jennifer R
    Jennifer R Published |

    I don’t know why wordpress does not add the menu function by default to the main admin menu? we must register it to the theme for it :(

    Reply
  129. How to update your theme with WordPress 3.0 navigation menu | WP Journo | WordPress & Journalism
  130. Leland
    Leland Published |

    Hey all ,

    How do we go about adding the “home” link via Custom Link from the new WP3 menu builder but also have it assigned a “current_menu_item” class when we are viewing the index page. What is the best way to append a “home” link to these new menus? Thank you.

    Reply
    1. Bradford
      Bradford Published |

      I found that it worked when you created a custom link WITH the trailing slash. It wouldn’t work without it, however if you do include the trailing slash (http://theblawblog.com/ in my case) it works.

      Reply
  131. kamal
    kamal Published |

    ONE Word : I LOVE YOU ;)

    ___________
    (Yeah it’s 3)

    Reply
  132. Frank Anthony
    Frank Anthony Published |

    Is it a bug or a feature that the following doesn’t work without a menu created?

    wp_nav_menu( array( 'container' => 'nav') );

    I want to include this function in a basic html5 framework theme, but if no custom menus are created yet and it falls back to a standard page list it doesn’t change anything…. it’s still an unordered list wrapped in a div with class=”menu”.

    'container' => 'false' doesn’t remove the wrapper div as expected either.

    Reply
    1. Frank Anthony
      Frank Anthony Published |

      Ok, I see now that it is a feature.

      It falls back to wp_page_menu()

      So you can either filter that function or create your own function and change

      'fallback_cb'     => 'wp_page_menu'
      Reply
    2. davidn
      davidn Published |

      I am also facing the problem that ‘container’ => ‘false’ is ignored. My problem game up after creating a “empty” child theme of a theme where ‘container’ => ‘false’ works fine. Have you figured out anything?

      Reply
  133. Thesis Should Become the New Default WordPress Theme Options Page
  134. Robin Anderson
    Robin Anderson Published |

    I’ve been searching for an example of the echo option. I want to use the new menu structure (I have it in place), however I am using wp-ecommerce, which I can’t seem to get the product categories added to the new 3.0 structure. I want to return the menu, then test for a certain page, so I can output my own menu in php.

    Can someone either help me insert the product categories (not manually) into the main menu, or understand how the menu is returned when echo is false.

    (I’m using latest version of wp-ecommerce and wp 3.0)

    Thanks so much, Robin

    Reply
    1. Robin Anderson
      Robin Anderson Published |

      Never mind, being a dummy. It’s the same as wp_list_pages() echo it returns a string.

      Reply
  135. Aj
    Aj Published |

    Hi, i’m a begginer, so can somebody explain how to make primery menu? i should edit functions.php file. and this file is at host server? ishould paste

    add_action( 'init', 'register_my_menu' );
    
    function register_my_menu() {
    	register_nav_menu( 'primary-menu', __( 'Primary Menu' ) );
    }

    to the end of file functions.php?

    Reply
  136. Ryan
    Ryan Published |

    Very informational post Justin. I’m also really glad to see the custom Menus in WordPress 3.0. I have finally had an opportunity to experiment a bit, and I have been very pleased. However, I have come across my first problem. I want to apply a class to the actual link anchor, but the class I specify in the “CSS Classes” field is applied to the list element. I am currently trying to work around this, but I was just curious, what is your take on this?

    Reply
    1. Ryan
      Ryan Published |

      Ouch.. *informative

      Reply
  137. WordPress 3.0 – The Ultimate Roundup For Developers & Users | KreativeThemes.com
  138. dallas
    dallas Published |

    By changing line 163 in “wp-includes/nav-menu-template.php” from:

    $menu_items = wp_get_nav_menu_items( $menu->term_id);

    to

    $menu_items = wp_get_nav_menu_items( $menu->term_id, $args);

    the args list is passed along to wp_get_nav_menu_items (which already has a filter). it was pretty simple to use that filter, check for a “child_of” arg (which is now passed through from our “wp_nav_menu” call) and call a custom function based on the wp_list_pages filtering:

    function get_menu_children($parentID, $menu_items){
                $menu_list = array();
                foreach ( (array) $menu_items as $item ) :
                    if ( $item->menu_item_parent == $parentID ) :
                        $menu_list[] = $item;
                        if ( $children = $this->get_menu_children($item->ID, $menu_items) )
                            $menu_list = array_merge($menu_list, $children);
                    endif;
                endforeach;
                unset($children);
                return $menu_list;
            }

    That’s worked great to allow retrieving a sub-nav section of my menu while only changing one line of the WP core.

    wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary', 'child_of' => 43 )) 

    I’m sure there is a better way but this was the simplest for my WP-noob brain and didn’t require a bunch of hacking.

    Reply
  139. Davit
    Davit Published |

    Great article, as usual. However the term Theme Location I think needs some further explanation. For example why there appeared a need in such a thing at all. Why not just define individual menus directly?

    Reply
  140. Duy
    Duy Published |

    Hi Justin,

    Do you know how to differentiate a ‘li’ which has children items and a ‘li’ without ones?

    For example, here is my list:

    -Home
    -Products
    – Product #1
    – Product #2
    - About

    What I want is the ‘Products’ will have an arrow, or styled differently since it contain children while other ‘li’s don’t.

    Thanks for great article btw.

    Duy

    Reply
  141. Matt Edminster
    Matt Edminster Published |

    What advice could you offer for an attempt to style a menu with children as a dynamic submenu (following the approach described at http://www.triah.com/2010/01/09/color-menu-with-dynamic-submenu-using-css/) rather than nested drop-downs?

    Seems to me that the catch comes in wrapping parent links in one div and all child-links in another. Is there anyway to do this using one menu as opposed to creating a menu for parents and each child?

    Reply
  142. Eric Boyer
    Eric Boyer Published |

    I can’t for the life of me get posts to list under the new nav function. Can anyone give me a hand?

    Just like the navigation on THIS site… Writing -> Fiction -> *list of posts*. This is exactly what I’m looking to do.

    Reply
  143. JeremyT.
    JeremyT. Published |

    Not sure where you find the time to compose such detailed posts, but thank you heaps. I’m a WordPress newbie and the CMS and how to use it does overwhelm me sometimes. Your tuts make WordPress life a little easier…:)

    Reply
  144. hnla
    hnla Published |

    A great article that helped me understand applying the new wp_nav_menu.

    I have one question that has me stumped after a far bit of research.

    I am trying to extract the menu name a user may create and then attach to a menu region, I realise that the menu assigned to a particular region is not apparently the business of nav-menu.php ?

    I can access two arrays $_wp_registered_nav_menus() , and wp_get_nav_menus() for all the regions and menu objects yet I can’t find a means to correlate the two sets.

    For example I want to create a label from the menu name a user creates .

    I can’t know in advance the menu name or to what region the user assigns a given menu.

    I need to be able to do something along the lines of ‘If this region give me the menu parts assigned to just this region’.

    Not sure if that makes a whole lot of sense but any thoughts or pointers in the right direction would be hugely helpful.

    Reply
  145. alsd
    alsd Published |

    ‘depth’ is not working for wp_nav_menu?

    I have a parent category with a handful of subcategories, and I thought I will be getting this in a nested unordered lists that would allow me to style a dropdown menu:

    Parent menu
    -Sub menu 1
    - Sub menu 2

    Instead I am getting this:

    Parent menu
    Sub menu 1
    Sub menu 2

    My post in WordPress forum
    http://wordpress.org/support/topic/wp_nav_menu-not-displaying-subcategories

    Reply
  146. rowland
    rowland Published |

    I need help with something that I haven’t found an answer to.

    I have one business with three storefronts. Each storefront has a website. I have not yet used MU, but am in the process of figuring how to set that up now. (Thanks for your help!) Related to that:

    I am not blogging on these three sites, but will within a few months. For now, my issue relates to Pages on my WP website.

    The three websites (one for ea storefront) will be identical. All three storefronts will share some pages. Each store, however, will have a couple of unique pages. I want to be able to update the shared pages and have all three websites update. HOWEVER, I want each store manager to be able to update their own unique pages. I don’t want managers to have access to another store’s pages. I don’t want the managers having access to the pages that span all three stores.

    Can this be done? If so, how?

    Thanks.

    Reply
  147. Rob Watson
    Rob Watson Published |

    Justin,

    Great article, and thanks for being so good about responding to peoples’ questions.

    I’m currently scratching my head over the Classes settings. A client wants me to create a wordpress theme and gave me an xhtml template and CSS2 stylesheet with the following navigation styles defined.

    #nav1
    {
    	height:57px;
    	background:url('http://example.com/img/top1.png') no-repeat top center;
    }
    #nav1 a, #nav2 a
    {
    	display:block;
    	height:57px;
    	float:left;
    	border:none;
    }
    #nav2 #navHome
    {
    	width:119px;
    	background:url('http://example.com/img/nav1.jpg') 0px 0px no-repeat;
    }

    Now, these are CSS ids, so I converted them to classes by removing the # and replacing it with a .

    .nav1
    {
    	height:57px;
    	background:url('http://example.com/img/top1.png') no-repeat top center;
    }
    .nav1 a, .nav2 a
    {
    	display:block;
    	height:57px;
    	float:left;
    	border:none;
    }
    .nav2 .navHome
    {
    	width:119px;
    	background:url('http://example.com/img/nav1.jpg') 0px 0px no-repeat;
    }

    But, when I put “nav2 navHome” in the Classes setting, the menu items don’t style correctly. The rendered source shows up like this: Home but the design falls apart and is just linked text without the nav1.jpg button graphic.

    What am I doing wrong?

    Thanks.

    Reply
  148. Rob Watson
    Rob Watson Published |

    Oops. just realized the code i pasted in my comment for the rendered source actually got rendered in the browser as a link.

    Here it is with a the pre tag wrap, hoping that will display the code. Otherwise, just view source, I guess. Home News

    Reply
  149. tudor
    tudor Published |

    Hi. my menu doesn’t appear in the Appearance -> Menus panel.

    I’ve tried with the default code from http://codex.wordpress.org/Navigation_Menus, i’ve tried my code, nothing works.

    The menu still doesn’t appear in the Appearance -> Menus panel.

    If someone knows what’s the problem, please share. :)
    Thanks.

    Reply
    1. matt
      matt Published |

      Hi. I’m having the same issue. “my menu doesn’t appear in the Appearance -> Menus panel.”

      Does anyone have a solution to this, or have the same issue?

      I’ve created multiple menu’s, and they are all available in the “Theme Locations” dropdowns (and display correctly on the site) but the tabs which should be in the right column of the Menus page are not available and/or do not display. I can only create new ones, and not edit current ones.

      Please help!

      Reply
  150. Rob Watson
    Rob Watson Published |

    I figured out why it’s not styling. The classes are for the anchor tag but the menu system applies the class name to the list, not the anchor. Any way around this or will I need to revamp the CSS and template link code to resemble a list?

    Reply
    1. Bernhard
      Bernhard Published |

      Hi Rob,

      maybe I’m late and you found the solution:

      .nav2 .navHome a

      Reply
  151. Paul
    Paul Published |

    Great article! Thank you!

    Can you also tell us how to access and display “description”? I’m trying to find such function but I can’t get it anywhere.

    If you could help those seeking for such function (I noticed a few people asking for that on this page) that would be awesome!

    Reply
  152. Arturex
    Arturex Published |

    Thankks Justin,
    But i have a question sometimes we need to call an external page in a popup but i dont want the url to show or just want a new page I just to call it uding javascript:window.open() but now if i want to use the nav menu i dont have it as an options since always ask me for a url.. is there a way to do this?

    Reply
  153. Bill
    Bill Published |

    It would be great if there were a way to automatically add the title attribute, at least using the link text, instead of needing to add copy and paste it in every time a new page is added to a menu.

    Does anyone know if there’s a way to do this by chance?

    Reply
  154. Kenneth Henderson
    Kenneth Henderson Published |

    Here’s how to show the description and other parameters in the menu…

    // Hook nav rules to showing description page
    // Look details information by this page wp-includes/nav-menu-template.php
    // or by this link - http://core.svn.wordpress.org/trunk/wp-includes/nav-menu-template.php
    add_filter('walker_nav_menu_start_el', 'description_in_nav_el', 10, 4);
    function description_in_nav_el($item_output, $item, $depth, $args){
        $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';
        $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';
        $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';
        $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';
        
        return preg_replace('/([^<]*?)</', "" . "{$item->title}{$item->post_content}<", $item_output);
    }
    Reply
    1. Piet
      Piet Published |

      can’t get this to work out of the box, it basically only shows the descriptions and nothing else anymore. Shouldn’t it only show the descriptions when hovering over it? Thanks!

      Reply
  155. WebVostro
    WebVostro Published |

    I comprehend how to register a menu for a theme, but honestly, for those of us who are a little lack in the programming dept, it can get somewhat confusing.

    Thanks for sharing – you made the task a lot easier.

    Reply
  156. Arturex
    Arturex Published |

    Hi Again here i am playing with the menus, and a question came up my head,
    as i look to the generated code it seems to me way to long something like this..

    <li id="menu-item-309" class="menu-item menu-item-type-post_type menu-item-309".....

    is thre a way that if i dont need such a big classes of differents id's an option to generate a simpler class lets say something like

    <li class="menu-item "...

    just to make it look cleaner, but leave the ptin to put all of it if needed..

    Reply
  157. davoscript
    davoscript Published |

    A great thing would be if a function (or procedure) exist to create the custom menu with its options at once, this way we could set custom menus as default.

    I’ve been researching about this, but didn’t have any luck yet (and the lack of documentation doesn’t help) .. any suggestions?

    Regards,
    Nice article Justin.

    Reply
  158. Boysen Hodgson
    Boysen Hodgson Published |

    Do you know of any plugin conflicts?

    Menu is installed to upgrade an older site – Menu Admin shows up fine. I have upgraded 2 or three other clients without issue.

    When I SAVE the ‘mainmenu’ into the primary menu location … it’s not STICKING. I go to the dashboard, I come back … and no menu is selected.

    And what shows up on the site is a List Pages of everything, rather than the menu I was specifying. Any help appreciated.

    Thanks.

    Reply
  159. Bernhard
    Bernhard Published |

    Hi Justin,

    great tutorial for a great feature of Wordpress 3!

    Sure custom menus is now only version 1.0 and I didn’t expect something like that to come upto I’ve seen it.
    But the more you get, the more you want…

    Is there any possibility to move a parent menu item including all it’s children from one menu to another? Maybe a plugin?
    Also I would like to have the possibility to hide children in the admin panel for having better overview but to show more than one menu at the same time (this would be necessary to be able to move menu items from one menu to another).
    Another goodie would be an option to select for example 18 items in the add menu items box and add them directly as children of an existing menu item.

    Are there any plugins for customizing the admin panel for custom-created menus?

    Reply
  160. Amanda
    Amanda Published |

    Is there a way to include a search term in the menu? For example, I have a menu item “post category” (news), and I want children of that to be “latest posts”, “posted a week ago”, “posted a month ago”, etc

    Reply
  161. angga
    angga Published |

    how to get menu item.
    i don’t want ul or div tags.
    just menu items data

    help please

    Reply
  162. Mike Goodstadt
    Mike Goodstadt Published |

    Maybe I missed it but can someone give me a hint/link/snippet for how to control or change the default WP menu animation style.
    At the moment it slides down (sloooowly depending on the browser/OS/machine) on mouse over.
    I would like it to be onClick (revealing at the same time the parent page) and quicker or even without slide/animation.
    Do I really have to hack ‘nav-menu.dev.js’???
    How would I integrate the SuperFish plugin as mentioned abouve without messing up the WP one?
    Grateful for all pointers as there seems to be zero documentation on the effect used.

    Reply
  163. Mike Goodstadt
    Mike Goodstadt Published |

    Ok Ok all have a wee snigger – it’s in the Hybrid theme itself – the ONLY js there is… and extremely easy to edit to ones own taste – and call by myself when I un-commented the line in the Skeleton template :-)
    I am sooo used to hacking my way through the coding undergrowth that I forgot that this is not virgin territory and we have our own Quatermain (or Challenger or Muntz depending on your century…) boldy going…
    Thanks Justin and all at DevPress!

    Reply
  164. Christian
    Christian Published |

    Thanks a lot, you saved me a lot of time.

    Greetings from
    Germany

    Reply
  165. Zero
    Zero Published |

    This Rocks !!!!!!!!

    Reply
  166. Sahil
    Sahil Published |

    Very Details and Awesome Tutorial, I was looking for a tutorial on Custom Menu for such a long time, Found many but they never explained in so depth. Great Work Cheer:)

    Reply
  167. Fredrik Andersson
    Fredrik Andersson Published |

    Hi,

    It worked out perfectly for me to make the design and functions as i wanted with the menu. BUT then come the problem, when I have a network, how should this work then?

    I switch back to hardcoded just because that problem ;)

    Reply
  168. Petra
    Petra Published |

    That’s a great tutorial. However, I have a problem.. My menu consists of pages and categories, but when I view the website in a web browser I can only see the pages. Is there a code needed to view categories as well? (I do have some posts in those categories by the way.)
    Your help would be much appreciated.
    Thanks.

    Reply
  169. Robin
    Robin Published |

    It would be great to know how to remove all the extra big classes crap on menu items.

    Reply
  170. Stacey Moore
    Stacey Moore Published |

    Thanks for the very useful info. Regarding your request for a “menu logic” plugin… You can use widget logic on menus within the custom menu widget.

    Reply
    1. Ray
      Ray Published |

      Wouldn’t this mean you’d have to use widgets **and** menus though?

      Reply
  171. Srikanth AD
    Srikanth AD Published |

    Your tutorial helped me to create a drop down menu with some (non hyper-linked) parent items.

    Thanks

    Reply
    1. Manish
      Manish Published |

      Hi Srikanth,

      I’m building a theme and using wp_nav_menu to display menus. I’m wondering how to have parent page link from not linking to a page since child items are the once with information.

      Reading your comment, I think you’ve accomplished this. If, can you please share how or point me in the right direction.

      Thank you in advance.

      Reply
      1. Manish
        Manish Published |

        Hi, I resolved this myself. I simply created a custom link at Appearance > Menus and then added the name of the page there as the label. Once it’s in the menu I replaced Parent page with the custom link I just created. Then I expanded custom link and removed the URL.

        Thanks for this thread and it helped me on my thinking process.

  172. Yahya
    Yahya Published |

    Hey Justin, the parameters list proves to be an awesome load of info! Thanks man! =D

    Reply
  173. Rob
    Rob Published |

    Is it possible to insert onmouseover and onmouseout events via the wp_nav_menu menu insertion function?

    For example, I’d like to take this wp_nav_menu generated code:

    <a href="http://example.com/blog/?page_id=16" rel="nofollow">News

    and insert onmouseover/onmouseout like this:

    <a href="http://example.com/blog/?page_id=16" rel="nofollow">News

    Is that supported somehow in the args passed to wp_nav_menu? I’ve read the Codex, but can’t wrap my head around how to do this.

    Thanks.

    Reply
  174. Rob
    Rob Published |

    Grr. I can’t get code to appear in my comments. See http://wordpress.org/support/topic/onmouseover-events-in-wp_nav_menu for what I mean.

    Reply
  175. James
    James Published |

    Hey Justin,

    I have a client that is always asking for custom menus for a group of pages. I.E. the page Dogs and the 3 sub pages, Husky, Hound and Terrier all display the same menu but Cats and the sub-pages of Cats all display a different menu.

    So far I have been able to limp along. My question for you is how to handle this situation with 3.0 Custom Menus… any ideas?

    Reply
    1. Ryan
      Ryan Published |

      Build your menus, then use http://codex.wordpress.org/Function_Reference/in_category

      if(in_category('dogs'){
      wp_nav_menu( array('menu' => 'dog menu' ));
      }
      if(in_category('cats){
      wp_nav_menu( array('menu' => 'cat menu' ))
      }
      Reply
  176. Ryan
    Ryan Published |

    The next step is to make menus keyboard accessible…

    It would be nice to make certain elements conditional.

    Reply
  177. Francisco Valverde
    Francisco Valverde Published |

    Great article! I would just to learn a bit more. I am developing a system of pages-subpages-’subsubpages’, that is a three level hierarchy, and I would like just to use three menu system: primary, secondary and tertiary. So the first menu will always appear. The second menu only when I am in a page with subpages, and the third menu when I am in a subpage with ‘subsubpages’. I am getting close but I would appretiate any help!

    Reply
  178. ZigPress
    ZigPress Published |

    Many thanks for this handy “everything in one place” reference. Much easier than sifting through four or more Codex pages! Bookmarked.

    Reply
  179. Aga
    Aga Published |

    Thank you, Justin, for the article. It helped me to get into the subject easily.

    Is there a way to get rid of the classes e.g.: id=”menu-item-47″ class=”menu-item menu-item-type-post_type menu-item-47″

    I use serveral menus on my page and just want to remove the code I don’t need.

    Reply
  180. Daniel Tomasch
    Daniel Tomasch Published |

    @Justin,

    Excellent Article!

    I’ve got a stumper for you —

    On:

    http://www.diplomatswashington.com/view/wordpress/about

    I have several WP Nav Menus. They work just fine on pages and on single.php

    However, under:

    http://www.diplomatswashington.com/view/wordpress/category/events/advancedfocused-morning-programs

    All the menus disappear! They disapear under any archive.php or category.php page — but show up everywhere else. Any suggestions?

    Reply
  181. Dimitar
    Dimitar Published |

    Wonderful, yeah, but what if I need to place an image (with or without a link behind it) to be my first (or whatever) item in the list?
    For example, I want my “Home” link to be an image and I need it to be marked as the current place (by CSS means) when I am there. Is it possible?

    Reply
  182. August WordPress Meetup at Paper Street Motors « Ferndale WordPress Meetup Group
  183. Lily
    Lily Published |

    Hi, thanks for this article. But I need help!

    I don’t know what I’m doing wrong, but what I have showing up now is both the text menu and the images that I want to replace the text (but they’re not showing up fully).

    My question is, after registering and setting up my custom menu, do I still need to hard code it somewhere?

    I used the ‘class’ option (after reading that it was hidden in the screen options… thanks to those who pointed that out!) but the images aren’t replacing the text, they’re just overlapping.

    (sorry, I don’t know php and i’m still a n00b when it comes to coding)

    thanks!!

    Reply
  184. sebastien
    sebastien Published |

    i have a category “food” with category-children “patatoes”,”apple”,”bread” etc…
    I drag’n drop the item “food” in my menu. But i want that all the children appears too in my menu. Is it possible to display all the children in the menu ? (i don’t want drag’n drop all the children, because, for example, i have 150 000 children for this category)

    Reply
  185. Jonathan
    Jonathan Published |

    I need some help please, You seem to understand this widget this best… I’m not sure what I need to do to fix this problem.
    Problem: when viewing my blog as a visitor, you should be able to “drag & drop” the sidebar menu anyway you like it, in IE, Safari, or Opera no problems but in Firefox it doesn’t remember my preference from page click to page view – it used to, (had to reload Firefox 2 days ago) And in Chrome the menus won’t collapse at all and I’ve been trying to figure this one out for weeks… Am I missing some sort of plug-in support? Any help or response would be much appreciated.
    Jonathan

    Reply
  186. jonathan
    jonathan Published |

    Submitted earlier about custom menu drag & drop issues, – Resolved for Firefox it was the Google toolbar – 6 causing the problems went back to 5 no problems…

    Reply
  187. Filipe Kiss
    Filipe Kiss Published |

    Hey Justin,

    I was wondering… is there any way to ‘export’ to menu to recreate it programatically?

    Reply
  188. thinkdj
    thinkdj Published |

    Great tutorial. This is pretty much the only WP 3.0 menus tutorial online which covers the topic in this detail.

    Reply
  189. DrSpectAcula
    DrSpectAcula Published |

    using the wp_nav_menu… (excuse this is quite a mouthful)
    would it be possible to have the submenu class of the current-menu-parent not show on a :hover of another menu-list item?

    In other words, is it possible for css for step back a level and then affect a lower one.

    i.e. Hovering on any top level menu item overwrites the static submenu being shown (overwritten with the hovered menu item’s sub menu)

    e.g. ul#menu-main li.menu-item:hover [ some selector here to step back a level ] .current-menu-parent .sub-menu {display:none;}

    Reply
  190. Teo Maragakis
    Teo Maragakis Published |

    Hi, one question. I am building a custom navigation menu which gets images related to the items, for example, if the menu consists of page entries, an icon (taken from a custom field in the page). Is this possible?

    To make it simpler, if I have a menu that includes pages, I want a loop to search in the text/metadata each menu entry. Is this possible?

    Reply
    1. Christian Sisson
      Christian Sisson Published |

      Same question here: is it possible to show both post-image and excerpt on a menu? Anyone?

      Reply
  191. John
    John Published |

    The question about having a second navigation menu hasn’t been answered yet? Hopefully, the answer wasn’t it being incomplete. I hope someone can shed some light as to how to create more than one menu.

    ps. I have tried all the examples and still no luck. the theme location stuff isn’t working. this is what I have in my functions,

    add_action( ‘init’, ‘register_my_menus’ );
    function register_my_menus() {
    register_nav_menus( array(
    ‘header-menu’ => __( ‘Header Menu’ ),
    ‘content-menu’ => __( ‘Content Menu’ ),
    ‘footer-menu’ => __( ‘Footer Menu’ )
    ));
    }

    and within the theme at different locations I would add, ‘header-menu’ ) ); ?> or ‘content-menu’ ) ); ?> or ‘footer-menu’ ) ); ?>. I am still not getting the menus I created in the backend to show up accordingly.

    Thanks.

    Reply
  192. Vaseem Ansari
    Vaseem Ansari Published |

    Hello Dear
    i read this post and tried few tricks, its really nice, but my problem is still unresolved.
    i have a query and i know that you know the answer of this
    i am using wp nav menu to show 6 navigation menu in header here
    http://showprojects.net/projects/csrc/

    Now i want when user clicks on any item(post,page,category,tag) in sub menu then the left sidebar will show all the submenus of that parent.

    My question is similar to this thread
    http://wordpress.stackexchange.com/questions/2802/display-a-only-a-portion-of-the-menu-tree-using-wp-nav-menu

    Explaination
    Root Menu
    Sub menu 1
    Sub menu 2 (clicked)

    My sidebar will show only child sub menus of clicked root menu
    Sub menu 1
    Sub menu 2 (clicked)

    Waiting for your answer.
    Thanks
    Vaseem Ansari

    Reply
  193. Wade
    Wade Published |

    I know I am beating a dead horse here but thank you for this great tutorial! It saved me a ton of time adding menus to a wordpress theme I am creating.

    Reply
  194. Phil Gwynne
    Phil Gwynne Published |

    Many thanks for this, just what I was after and more!

    Reply
  195. Vale
    Vale Published |

    Great article.
    Is there a way to control (ie not include) also classes and ids of the ul, li and a elements generated in the menu?

    Reply
  196. John
    John Published |

    Great tutorial, thanks for this article.

    Reply
  197. matt
    matt Published |

    Hi everyone, I posted a similar question in a reply, but am going begin a fresh post to better explain my issue(s) in hopes that someone can (puhleeeeeease) shed some insight into my problem and hopefully (on my knees begging) that someone can help find a solution.

    When I create/save a menu (Appearance > Menus > Menu Name > Create Menu ) and select/save it from the dropdown menu (Appearance > Menus > Theme Locations > Save) I am unable to select or edit the menu when I leave and/or refresh the screen. The menu displays correctly on the website, but I can no longer edit, without creating a new menu and replacing it.

    Also, unsure if this is related (I’m guessing it might be) but when I create categories (Posts > Categories > Add New Category) they disappear when I leave and/or refresh the page, and do not show up as an option when creating a new post.

    I’ve only had these issue since installing Worpress 3.x. I’ve re-installed fresh twice (mac 10.6.6/xampp).

    Hopefully someone can help me, I’m at my wits end. Thanks again!

    Reply
    1. matt
      matt Published |

      Seems this may be a dead thread, but if anyone is having the same issue as I was experiencing, it was due to not having proper permissions setup on the /Applications/XAMPP/xamppfiles/etc/my.cnf


      open terminal and navigate to the folder with my.cnf
      type: sudo chmod 600 my.cnf

      hit enter then input your password. Restart mysql and you are good to go

      (big thanks to Dan!)
      ref; http://slopjong.de/2009/08/31/houston-i-cant-write-to-file/comment-page-1/#comment-13866

      Reply
  198. grubbs
    grubbs Published |

    Thanks for this exellent tutorial

    Reply
  199. Luis Abarca
    Luis Abarca Published |

    Very helpful, thanks a lot !!

    Reply
  200. Levani
    Levani Published |

    Is it possible to wrap only top level menu items with some code? For example I want to wrap only top level menu items in tags… How can I determine whether the item is child or not…

    Reply
  201. Levani
    Levani Published |

    I meant span tags…

    Reply
  202. Tim LeB
    Tim LeB Published |

    Hi guys,

    I want to use menus and read the entire article but i’m a total noob at that and I understand nothing at all..I have a theme that says ”doesn’t support native menu” but i’m trying to get this done and can’t figure it out, is there a plugin or something like that?

    Reply
  203. Gordon
    Gordon Published |

    Hello,

    that was exactly what i was looking for. Just create a new design for my blog and tried to add a second menu. Wasn’t working until I found your article. Now it works. Very good description. Thanks for sharing your knowledge.

    Reply
  204. André
    André Published |

    Hy, yall gr8 tutorial! the only thing is that i’m facing with this problem, i have a parent/child relationship for my menu i want to unlink the parent when the children exist. How can i do it please?

    Reply
  205. Braintrash
    Braintrash Published |

    The 3.0 menu system is giving me and the headache, and the suicidal will. Maybe can you explain me what’s wrong? This is what happens chen I try to log into the admin area:

    register_nav_menus( array( 'header-menu' => __( 'Header Menu' ), 'footer-menu' => __( 'Footer Menu' ), ) ); // if no menu pressent fallback to.... used in wp_nav_menu function header_fallback() { echo '
    '; wp_list_pages('title_li='); echo '
    '; } function footer_fallback() { echo '
    '; wp_list_pages('depth=1&title_li='); echo '
    '; }
    Warning: Cannot modify header information - headers already sent by (output started at /var/www/clients/client9/web7/web/wp-content/themes/ServiceCulturel/functions.php:11) in /var/www/clients/client9/web7/web/wp-login.php on line 354
    Reply
  206. Enrico
    Enrico Published |

    Hi Justin ,

    can i dissect a wordpress menu?

    Is possible display the singles voices of a menu in different themes places?

    Reply
  207. @ommunist
    @ommunist Published |

    Actually, Alan Trewartha’s awesome Widget Logic plugin works very well with jQuery slick menu widgets for WP made by @designchemical. All you need is to specify appearance of menus in your theme by means described in your article and use widget logic to display slick jQuery menus on the range of pages you need. Works well with qTranslate too.

    Reply
  208. bastom
    bastom Published |

    Is it posible to add something to one menu title? For example, i’m listing my navigation, and it shows something like:
    Home | Forum | Inbox | About | Links
    Instead i would like the Inbox menu to have a count next to it with unread messages. Ex.:
    Home | Forum | Inbox (1) | About | Links

    Is something like this posible? Or do i have to first get every menu out of some query?

    Reply
  209. Mavo
    Mavo Published |

    Finally, you made me understand the fallback feature that is not well documented. Even the comments in the code were a bit obscure at start. After your article I managed to find the code for that in wp-includes/nav-menu-template.php. Thanks, now the picture is clearer, as the power of this new menu structure. One more step towards a more complete CMS! :)

    Reply
  210. Matt
    Matt Published |

    Great article – thank you for explaining menus in detail for us development-types!

    I don’t suppose there’s a parameter to set a maximum number of menu items to display? I’m trying to keep users from breaking the layout by only allowing for a certain number of menu items on specific menus…I could probably do some hiding with CSS, but would like to keep things as semantic as possible :) Thanks.

    Reply
  211. Olivier
    Olivier Published |

    Hello,

    Nice post.
    I was wondering if someone has implemented the following:

    I some pages, I need to display my menu, but only showing the sub-menu of the current page ID.
    The sub-menu can be either a page, or a category …

    For example, if my menu is:
    Page1
    Page2
    -Category1
    -Category2

    If I’m in the Page2, I want Category1 and Category2 to be displayed …

    Thanks a lot.

    Reply
  212. Sandra
    Sandra Published |

    Really very easy way to handle with menus in word press.
    WordPress 3.0 menu system just looks amazing.

    Reply
  213. Johnny
    Johnny Published |

    Thanks, finally a nice clean article about the WP menus. Really needed that :)

    Reply
  214. WordPress Custom Menus | Stuff by Sarah
  215. Wordpress and navigation | King Luddite
    Wordpress and navigation | King Luddite at |
  216. Usme Cah
    Usme Cah Published |

    Thanks for this post, it’s the only solid guide I found to implementing this.

    I had a few hopefully constructive observations (not that it’s your responsibility, right? Haha, well, I’m sharing them here because I’m thinking about them.).

    #1 I can’t believe the “current-menu-item” remains a link, an anchor tag, rather than being program-auto-matic-ally replaced with a span.

    #2 I am also highly amused by the fact that the default architecture (which I guess you’d have to write a custom walker function to get over, which seems a bit too deep, frankly, for a simple class change) shoves like 8 classes into the list item, but puts not one single class on the anchor.

    This forces you to do a 3-level deep selector to customize an individual menu’s current menu item. What’s the point in overloading classes if you’re not enabling a better CSS architecture than that?

    That’s my biggest issue so far. Well, that, and I’d really like to see WordPress show some more consistency in the options it gives for configuration.

    #3 Take widgets. I can set before_widget, after_widget, before_title, and after_title. Those take full HTML and a replacement placeholder for default WordPress classes. For menus I get container, container_class, and menu_class. Those take tokens only (ie ‘nav’, ‘class’, ‘class’).

    Oh, well. I’m sure that will get smoothed out as it evolves. I do love WordPress and this is a vast improvement over the page widget I was using before!

    Reply
  217. Gaby
    Gaby Published |

    Hi Justin!

    Firstly, thank you for this awesome post!

    I’m trying to do my first wordpress theme and I’d like to include one main menu and (depending on the selected option) a subpages or a subcategories menu. Because some items are pages and some items are posts…. I would like to keep this submenu visible even when I’m reading a post… Is it right to do one main menu and one menu for each ‘suboption’ and show/hide the second one depending wich option I chose? How could I link both menus?

    I’d really appreciate any advice!
    Thank you

    Reply
  218. Darwin
    Darwin Published |

    I like your last menu tab HOME-ABOUT-VIDEOS-CHANNELS-WEBLOG. But how I can do this in my website. Please help me. Thanks

    Reply
  219. Puneet
    Puneet Published |

    Justin, really you wrote a very informative post, I really appreciate, keep it up…

    Reply
  220. ExpressGreen Paper Bags
    ExpressGreen Paper Bags Published |

    Thanks for the detailed artcile Justin… that was quite useful.

    Reply
  221. ice
    ice Published |

    Thank for your fantastic information,
    when i will try it at the “head.php” like this

    old code
    =====
    …..

    <li><a rel="” title=”” href=””>

    …..

    new code
    ======

    ‘primary-menu’ ) ); ?>

    …..

    it work, but when i want to disable primary menu for use defult menu.
    the menu botton link not show, but other page menu can show .

    how can i Solve it!

    Thanks . ^^!

    Reply
  222. Jonas
    Jonas Published |

    Hi there Justin. First of all I would like to thank you for a very interesting article. God job. When that’s said, I would like to ask you a question. Menu_class and menu_id will give the ul a class or an id right? For some reason, it wont be applied to the ul. Menu_class creates a div around the ul with the chosen classname and menu_id doesn’t seem to have an effect at all. Can you help? In advance, thanks.

    This is written in functions.php:

    This is written in header.php:

    ‘primary-menu’, ‘menu_id’ => ‘nav’, ‘menu_class’ => ‘clearfix’ ) ); ?>

    Reply
    1. Jonas
      Jonas Published |

      This is written in functions.php: (ofc. with the php tags wrapped around)

      add_action( ‘init’, ‘register_my_menu’ );
      function register_my_menu() {
      register_nav_menu( ‘primary-menu’, __( ‘Primary Menu’ ) );
      }

      This is written in header.php: (ofc. with the php tags wrapped around)

      wp_nav_menu( array( ‘theme_location’ => ‘primary-menu’, ‘menu_class’ => ‘clearfix’, ‘menu_id’ => ‘nav’ ) );

      Reply
  223. Registery
    Registery Published |

    I use themes “Inove”, i was copy script to themes fungtion, but it’s not work. Please tell me how must i applied?

    Reply
  224. Judie
    Judie Published |

    Hi Justin,

    I know this article is older, but I was hoping you could direct me to resolve an issue I am having with my Menu. Every time I try to add more pages to it, and select Save; it comes up with this error:
    ___________________________________
    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.
    Apache Server at ourledconnection.com Port 80
    _______________________________________

    And my sites menu looks like a MESS right now with all of the pages all over the place and not in any hierarchy order.

    The Glide Theme guys says that it is not his issue, GoDaddy says that it is not their issue, everything on my site is correct – yet I do not know how to address resolving this problem.

    I have unloaded, reloaded, unplugged, replugged and yet this is still persisting. I have goggled this and other people have had this issue, but I have not found the way anyone has fixed it.

    If you could help me, or direct me to how I can fix this, I would be extremely grateful!!

    Thank you,
    Judie :)
    P.S. I am not html savvy but could hopefully get someone to help me who might be.

    Reply
  225. Katrina
    Katrina Published |

    Hi Justin,

    Thanks much for all the info—this is one of the most complete I’ve seen on the web (and I’ve searched through many!). Just wondering if you can tell me how to move my menu up/higher so it will align to my logo?

    Any help would be really appreciated! Thanks!

    Reply
  226. Randy
    Randy Published |

    I’m new to wordpress……

    I’m working on an iMac using MAMP Pro to create and debug my website – I have created a very large “Custom Menu” in WP3. Now that I am moving the site to a test domain so the client can review the new new menu layout – all is well with the look of site (theme) but no custom menus.

    I did the export / import tool – am I missing something or do I need to recreate the custom menu and the new server??????

    One would think “export site and all of your settings” would be ALL OF YOUR SETTINGS not just some.

    Please help!!!!!!!!!!!

    Reply
  227. Nadja von Massow
    Nadja von Massow Published |

    Unfortunately, custom menus are messing with any shortcode or plugin that requires a sorting order other than ASC. After eliminating all possible problems and hickups, I found out that only the default menu allows for a certain short code arguments to be accepted.

    I.e. various plugins that allow to display / pull in category posts into a page or post, or even template tags that do the same. All sort-orders suddenly default to “ASC” and cannot be overwritten. It only seems to remain fine within category pages themselves.

    Reply
  228. Shajjad
    Shajjad Published |

    Thanks for a great and great post. Its may be more that 5 times that i am visiting your website for adding wp 3.0 navigation for wordpress.
    But its first time i am commenting,,
    Again thanks for this awesome post.

    Shajjad, Bangladesh

    Reply
  229. Customize my Wordpress Navigation Bar |
    Customize my Wordpress Navigation Bar | at |
  230. Ole Henrik
    Ole Henrik Published |

    Hi,

    I have searched for two days without finding out how I add custom post types to the admin menu screen.

    I’m looking through the nav-menu.php file but its hard to figure out how to register a new post type in there.

    Please let me know if you have done this before or got any tips at all.

    Reply
  231. Stefan
    Stefan Published |

    I’m a rookie in theme building for WordPress, so this article really helped me out. Thanks for the clear explanation

    Reply
  232. nomadone
    nomadone Published |

    I know this is an old tut, an excellent one at that most people are linking back to this as one of the original intros.

    I’m trying to figure out the exact relevance of

    add_action( 'init', 'register_my_menus' );
    function register_my_menus()

    Is it necessary to create and initialize an additional function? What is the purpose of doing so. I see quite a few tutorials recommending this but none explaining exactly why or what the consequences of not doing so could be.

    Reply
  233. Eran Mahalu
    Eran Mahalu Published |

    Hi and thanks for the tutorial. I have one issue with it, though:
    When I define a primary and secondary menu in the functions.php, and then call the secondary menu in a specific page – it shows both menus combined. How do I avoid it?

    Reply
  234. Mike
    Mike Published |

    Well, this page has a ton of information but I’m not sure if it’s applicable to what I want. I’m hoping someone can respond here to help me out.

    I have a header with a main navigation menu and it works fine. I have created a second menu in the appearance/menu section of the WP admin panel.

    All I want to do, is have a way to show the second menu, in the BODY portion of specific pages. The header and main menu will still be there, but I want another menu a bit down the page that I can use just to navigate through some pages that are all related so I don’t clutter up my main menu.

    Is there a simple way to do this? Am I just overlooking something up above? I’m just not sure how much of the stuff in this post is relevant to what I’m trying to do .

    Any help would be most appreciated.

    Thanks!!

    Reply
  235. WordPress 3.0 Overview – notes - WP Austin
  236. Adria
    Adria Published |

    PLEASE HELP!!!!

    Why am I getting this error every time I try to make a change to my secondary nav menu? :(

    Server error
    The website encountered an error while retrieving http://www.dwuathletics.com/wp-admin/nav-menus.php. It may be down for maintenance or configured incorrectly.
    Here are some suggestions:
    Reload this webpage later.
    HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

    Reply
  237. David H
    David H Published |

    Justin, I have your Pro Plugins next to me!

    Now, for your expertise.

    I have a Taxonomy plugin installed for a custom theme where the custom Taxonomy tags are used to create the equivalent of WP categories. This plugin outputs a completely indented list of parent, child, child of taxonomy, etc.

    But the default Walker in wp_includes/category-template.php start_el() somehow processes wp_list_categories so that the Count on a Taxonomy list gets written outside the link tags as in;

    &L;ta href="#" rel="nofollow">Top Tax Parent</a>(5)

    This creates the Count sitting on a line below which cannot be CSS styled inline.

    I found a hack that modifies the start_el() so that something processed by wp_list_categories will give me “pretty links” for navigation –

    Category count INSIDE:

    <a href="#" rel="nofollow">Top Tax Parent (5)</a>

    Since I am running a child theme I don’t want to have to keep re-modifying this core set of functions which starts way below the wp_list_categories function in this file.

    What had to be modified was here:

    **
     * Create HTML list of categories.
     *
     * @package WordPress
     * @since 2.1.0
     * @uses Walker
     */
    class Walker_Category extends Walker {
    	/**
    	 * @see Walker::$tree_type
    	 * @since 2.1.0
    	 * @var string
    	 */
    	var $tree_type = 'category';

    all the way through the Walker_Category.

    It is a real drag that no matter what other child theme alternate Walker classes are created that all of them NEED to process their args through that stretch of code that includes start_el().

    It is specifically the start_el() that throws the Count “off”, so to speak.

    And this function really HIDES OUT, forcing its output on all other Walker extension classes.

    Do you have a foolproof way to kick this guy out of action permanently in my theme?

    The remove_action stuff and the

    if function(wp_press_core_function) {
    || do this instead
    }

    I understand that I cannot use filters, that I must use a action instead.

    Could you help with this?

    Thank you very much.

    Reply
  238. Leila
    Leila Published |

    I am trying to call two columns from a different site theme location. Is there a way to do this?

    http://cahnrsnew.mnec1.wpengine.com/

    Down at the bottom the academic and service I am wanting to re-use this information on http://academic.mnec1.wpengine.com/ in the same location.

    Reply
  239. Greg Turner
    Greg Turner Published |

    I have released a plugin called Zen Menu Logic that allows you to specify on a per page basis, which one of several custom menus appears in the primary menu location of the page:
    see: http://wordpress.org/extend/plugins/zen-menu-logic/

    Reply
  240. Adam
    Adam Published |

    This was very very helpful thanks ever so much!

    I am in the process of creating a website using wordpress using a theme that doesn’t natively support menus.

    This tutorial saved the day!

    Thanks again.

    Reply
  241. Fred R
    Fred R Published |

    Nice article, and I am really struggling with menus so it’s helpful. However, I must be missing something really, really obvious, because the screenshot below “What the menu system offers” looks nothing like the Appearance >> Menus dialogue I get in WP 3.3. What is it I’m missing, can anyone tell me? If what I saw were the same as the screenshot I’d be a happy bunny indeed :o)

    Reply
  242. Ahnaf Abid
    Ahnaf Abid Published |

    I was looking for more about nav-menu in codex just found your link. It is really helpful for who love wordpress. Thanks for the great article.

    Reply
  243. tipograf ieromonah
    tipograf ieromonah Published |

    The way of doing menus in wordpress make php code looks like we are programming in javascript, lots of functions calling other functions. Using kohanaphp since version 2 I fill terified when see not so sexy php code. But, in the end, results are all that matters, does it?

    Reply
  244. pibe
    pibe Published |

    Hello,

    How many menus we can use in our Wordpress?

    Reply
  245. Elaine
    Elaine Published |

    Hi Justin, thanks so much for this awesome tutorial.
    I’m fairly newbie, though, and I need help actually adding the menus to the various pages. Can you help me/point me in the right direction?
    Thanks!

    Reply
  246. Marisa
    Marisa Published |

    Hello Justin,

    Thank you for this lovely tutorial!

    I am wondering if you have any advice on changing the default horizontal wordpress into a vertical menu?

    Thanks again for all of your hard work!

    Reply
  247. Thommy
    Thommy Published |

    Dear Justin,

    Thanks for the nice tutorial.. i want add this method to some exiting themes.. but what is the easiest way to do this.. i tried a lot with the code below but my knowledge of code is in learning process..

    can you please help me..

    <a href=""></a>
    						
    						<a>]*[\"\']?[^>]*(.*?.>)/i', $content, $preg_match, PREG_SET_ORDER)) {
    								foreach ($preg_match as $preg_content) {
    									$get_subtitle = get_post_meta($preg_content[1], 'subtitle', true);
    									if (isset($get_subtitle) && !empty($get_subtitle)) {
    										$subtitle = "$get_subtitle";
    										$content = str_ireplace($preg_content[2], $preg_content[2].$subtitle, $content);
    										$content = preg_replace('/title=\"(.*?)\"/','',$content);
    									}
    								}
    							}
    							return $content;
    						}
    					
    						wp_list_pages('title_li=&sort_order=ASC&sort_column=menu_order'); ?>
    Reply
  248. WordPress Arena: A Blog for WordPress Developers, Designers and Blogger
  249. Le Blog Vélo France bonjour - velofrancemontpellier - Un site utilisant WordPress
  250. WordPress Adding Navigation Menus « Mansoorkhan T K
  251. Add Custom Navigation Menus to WordPress 3+ Themes | Haiz Design Note Pad
  252. Navigation Menus | Anand Verma
    Navigation Menus | Anand Verma at |
  253. rizalp
    rizalp Published |

    Hi Justin. Thanks for simple this simple tutorial. I’ve got question though, what’s the difference between $theme_location and $menu in the wp_nav_menu()? I don’t understand the definition mentioned in Codex :

    $theme_location
    (string) (optional) The location in the theme to be used–must be registered with register_nav_menu() in order to be selectable by the user

    $menu
    (string) (optional) The menu that is desired; accepts (matching in order) id, slug, name

    Could you clarify? Thanks

    Reply
  254. Custom menu ingebouwd | Utopia
    Custom menu ingebouwd | Utopia at |
  255. August WordPress Meetup at Paper Street Motors | Metro Detroit WordPress Meetup Group
  256. The big one oh!
    The big one oh! at |
  257. Matt Keys
    Matt Keys Published |

    The most frustrating thing for me when I first started using wp_nav_menu was making secondary / child menus that ONLY showed the child menu items. Other CMS’s I’ve worked with have included an option to start the menu off at a specified level.

    I’ve tried lots of workarounds like walkers, widgets, and plugins, but I have never been happy with them.

    I finally wrote my own plugin that extends the basic functionality of wp_nav_menu, and adds in the missing start_menu argument.

    you use it like this:

    wp_nav_plus(array('theme_location' => 'primary_navigation', 'start_depth' => 1));

    the above code here would output a secondary (split) menu. If anyone is interested in using it, you can get it at my website:

    Reply
  258. What’s on your WordPress Menu?
    What’s on your WordPress Menu? at |
  259. Slob Jones
    Slob Jones Published |

    All of a sudden we have this phrase, “theme location,” and I have no idea what it means.

    Never heard it before in reference to WordPress, and yet you begin referring to “theme location” with no explanation.

    Details, please?

    Reply
  260. Social media nav menus
    Social media nav menus at |
  261. Ansh
    Ansh Published |

    Excellent tutorial mate… loved reading it.. thanks

    Reply
  262. Tutorial – Week 6 – Breaking Out of the Blog | Musings of a 21st Century Renaissance Man
  263. How to update your theme with WordPress 3.0 navigation menu / WP Journo: WordPress & Journalism
  264. Francis
    Francis Published |

    Hi Justin,

    I’ve been looking around on Google and your page is the best introduction to Wordpress menus I could find. However I did not find the answer to the question I was looking for, namely what is the purpose of separating the concept of the menu location from the menu itself ? Why not just call a menu directly, using it’s id or name or what have you ? Why say there’s a location called “primary-menu” that refers to a menu called ‘Primary_menu’, instead of calling the menu itself ? I’m sure it must have been added in for a reason, but for the moment it just seems to add an extra level of complexity.

    Reply
  265. IT-Homer 科技博客 » WordPress 自定义导航菜单
  266. WordPress Thematic Links | Software Ideas
  267. Andrew J Macklin | Adobe Certified Expert Training & Freelance Artist
  268. kesar sisodiya
    kesar sisodiya Published |

    i wont to add more then two menu in my site .

    can anyone tell me hows it possible .

    Reply
  269. Mahmud
    Mahmud Published |

    Hi Justin,

    it’s been already so many replies and discussion. m not sure would you or any one here would be kind enough have a look in to my trouble and save me.

    pls check this menu from link here http://mahmudur.info/clients/sakhanassociates

    yet m wishing for my good luck.

    For you kind information I already know how add nomar navigation bar or menu which is only have few lis’ in side an ul having no class or ids’ or any div. Infact I can add drop down menus that consists 1st generation ul and 2nd generation ul inside any 1st generation lis’ and 3rd generation ul inside any 2nd generation li and must not have any class or ID or any div in anywhere inside the menu.

    However the problem starts here as I would like add div after an ul and before any li. each generation ul got their perspective class and i.e 1st gen ul got a wrapping div as well as its class. 1st gen li got class which is different then the 2nd gen li. both li got their own div. 1st gen li got 3 parallel ul each of them wrap with 2 div both the div got theri own class. 1st gen links got div that has class. and 2nd gen link got a class only.

    in coup of words this is ” single level multi column ” drop down menu.

    Wish I could make you understand what pressure I am taking and how much trouble I am in.

    thank you very much in advance for your replies.

    mahmud

    Reply
  270. WordPress 3.0 - Thelonious - Gumeni Mrav
    WordPress 3.0 - Thelonious - Gumeni Mrav at |
  271. Fuji
    Fuji Published |

    Hello.

    I have a problem with the menu in my menu screen close in:

    http://massatgesfuji.com

    becomes a burger (three stripes) but when adding a cache plugin, hamburger disappears.

    any idea to solve the problem?

    thanks ….

    Reply
  272. wp_nav_menu | Wordpress中文站点
    wp_nav_menu | Wordpress中文站点 at |
  273. Wordpress 3.9: Problemas con los menus de la plantilla
  274. Michael
    Michael Published |

    has_nav_menu() brought me here. Thanks for the example. Cheers.

    Reply
  275. DeeZinerKKSoft
    DeeZinerKKSoft Published |

    Hi. Justin

    I really want to get the following output using wp_nav-menu->

    /**********************************/
    
    example menu item link
    
    /**********************************/

    Please help me and give me the solution

    Reply
  276. Miloshu
    Miloshu Published |

    Thank you so much Justin, I am looking for active link via css, like this #primary-menu li.current-menu-item a

    Bye!

    Reply
  277. Justin Ng
    Justin Ng Published |

    nice article…

    thx Justin and God bless everyone and the world…

    a sincere blessing from hong kong..

    ^____^

    Reply

Leave a Reply

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution.

Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.

css.php