Commit Graph

111 Commits

Author SHA1 Message Date
Andrew Nacin 3a1e87c205 If a nav menu has no items, wait until after the wp_nav_menu_items filter before deciding whether to print nothing.
see [21868] for original commit. see #21576.
see #24035 for trunk.



git-svn-id: https://develop.svn.wordpress.org/trunk@24634 602fd350-edb4-49c9-b593-d223f7449a82
2013-07-10 05:14:43 +00:00
Sergey Biryukov ad40af5edc Add a filter for attributes on menu item links. props simonwheatley, DrewAPicture, SergeyBiryukov, nacin. fixes #16738.
git-svn-id: https://develop.svn.wordpress.org/trunk@23565 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-01 17:06:35 +00:00
Ryan Boren b8a9b92f54 Declare wp_rewrite as global in _wp_menu_item_classes_by_context().
Props andrewryno
fixes #7337


git-svn-id: https://develop.svn.wordpress.org/trunk@23309 602fd350-edb4-49c9-b593-d223f7449a82
2013-01-21 14:44:30 +00:00
Mark Jaquith 524e73f175 Consistently use $wp_rewrite->index instead of hardcoding "index.php".
props wonderboymusic. fixes #7337

git-svn-id: https://develop.svn.wordpress.org/trunk@23305 602fd350-edb4-49c9-b593-d223f7449a82
2013-01-18 13:44:22 +00:00
Andrew Nacin 80a1e11ab0 Confirm that the nav menu's underlying object is in the proper taxonomy before adding the current-menu-item class. props SergeyBiryukov. fixes #21369.
git-svn-id: https://develop.svn.wordpress.org/trunk@22302 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-25 20:32:01 +00:00
Andrew Nacin 32687208c3 Prime post term caches for nav menu items. Avoid doing so in frontend template functions as it remains unneeded there. see #22189.
git-svn-id: https://develop.svn.wordpress.org/trunk@22233 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-15 14:17:50 +00:00
Ryan Boren 7ba5099795 Objects no longer need to be explicitly passed by ref to call_user_func*() to be callable. Props wonderboymusic. fixes #21865
git-svn-id: https://develop.svn.wordpress.org/trunk@22118 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-04 20:00:16 +00:00
Andrew Nacin e33241bef0 If a nav menu has no menu items, print nothing (instead of empty container markup). props obenland. fixes #21576.
git-svn-id: https://develop.svn.wordpress.org/trunk@21868 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-16 17:07:56 +00:00
Ryan Boren 92ea34f6a2 Use set_url_scheme(). Props johnbillion, MarcusPope. see #19037 #20759
git-svn-id: https://develop.svn.wordpress.org/trunk@21664 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-30 13:33:00 +00:00
Ryan Boren 30218d5ea5 Introduce WP_Post class. Clean up ancestors handling. Props scribu, toppa. fixes #10381 see #21309
git-svn-id: https://develop.svn.wordpress.org/trunk@21559 602fd350-edb4-49c9-b593-d223f7449a82
2012-08-20 19:47:52 +00:00
Andrew Nacin c418e6c76e Remove unused global reference. props ampt. fixes #20863.
git-svn-id: https://develop.svn.wordpress.org/trunk@21252 602fd350-edb4-49c9-b593-d223f7449a82
2012-07-09 19:48:04 +00:00
Andrew Nacin 2aff808d88 Only output the class attribute in wp_nav_menu() if we have classes to add. Don't waste time on an strlen() call. props niallkennedy, fixes #20483.
git-svn-id: https://develop.svn.wordpress.org/trunk@20513 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-18 19:06:22 +00:00
Ryan Boren c855c642ea Clear strict notices for the walkers. fixes #19249
git-svn-id: https://develop.svn.wordpress.org/trunk@19679 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-04 23:03:46 +00:00
Andrew Nacin 43f6f952b3 Properly handle a blank nav menu custom URL when determining what page we're on. see #19699 for trunk.
git-svn-id: https://develop.svn.wordpress.org/trunk@19657 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-03 18:15:16 +00:00
Ryan Boren 676ba7043e Use one space, not two, after trailing punctuation. fixes #19537
git-svn-id: https://develop.svn.wordpress.org/trunk@19593 602fd350-edb4-49c9-b593-d223f7449a82
2011-12-13 23:45:31 +00:00
Andrew Nacin c0682ee59b Detect current menu items for root-relative URLs. props filosofo, fixes #15954.
git-svn-id: https://develop.svn.wordpress.org/trunk@18746 602fd350-edb4-49c9-b593-d223f7449a82
2011-09-22 02:25:57 +00:00
Ryan Boren eba71eb7c0 Bring out the shears.
git-svn-id: https://develop.svn.wordpress.org/trunk@17228 602fd350-edb4-49c9-b593-d223f7449a82
2011-01-06 04:11:14 +00:00
Ryan Boren 48a0f157b1 Don't assume queried object is a term. Fixes non-existent var notice. Props filosofo. fixes #15944
git-svn-id: https://develop.svn.wordpress.org/trunk@17109 602fd350-edb4-49c9-b593-d223f7449a82
2010-12-22 17:40:51 +00:00
Andrew Nacin 306bf053a6 Pass args to nav_menu_css_class filter. props scribu, fixes #15808.
git-svn-id: https://develop.svn.wordpress.org/trunk@16912 602fd350-edb4-49c9-b593-d223f7449a82
2010-12-14 13:25:07 +00:00
Mark Jaquith f2702dd794 Highlight home page Custom Nav Menu item even when extra query args are present in the URL (only if all other highlights fail). props filosofo. fixes #13994
git-svn-id: https://develop.svn.wordpress.org/trunk@16742 602fd350-edb4-49c9-b593-d223f7449a82
2010-12-06 03:54:57 +00:00
Andrew Nacin 63b4617b98 Check that ancestors are not the currently queried objects in nav menu classes. props filosofo, fixes #14518.
git-svn-id: https://develop.svn.wordpress.org/trunk@16731 602fd350-edb4-49c9-b593-d223f7449a82
2010-12-05 04:29:56 +00:00
Andrew Nacin 6843c0fa3c Escape the wrap ID and class attributes going into sprintf() and s/slug/wrap_id/ to make it more obvious. see #14235.
git-svn-id: https://develop.svn.wordpress.org/trunk@16520 602fd350-edb4-49c9-b593-d223f7449a82
2010-11-21 13:37:09 +00:00
Andrew Nacin 83e8f71361 Introduce items_wrap arg to wp_nav_menu(). props filosofo, fixes #14235.
git-svn-id: https://develop.svn.wordpress.org/trunk@16519 602fd350-edb4-49c9-b593-d223f7449a82
2010-11-21 13:32:02 +00:00
Andrew Nacin 6524af3915 Add menu-item-object-$object class. props filosofo, fixes #14053.
git-svn-id: https://develop.svn.wordpress.org/trunk@16095 602fd350-edb4-49c9-b593-d223f7449a82
2010-10-29 22:49:42 +00:00
Andrew Nacin 7e48ac3e78 Pruning shears.
git-svn-id: https://develop.svn.wordpress.org/trunk@15904 602fd350-edb4-49c9-b593-d223f7449a82
2010-10-21 19:55:28 +00:00
Andrew Nacin fb4e38b0e7 Pinking shears.
git-svn-id: https://develop.svn.wordpress.org/trunk@15843 602fd350-edb4-49c9-b593-d223f7449a82
2010-10-19 07:48:22 +00:00
scribu b3bcb5f77e Remove redundant call to function_exists() in wp_nav_menu(). Fixes #15094
git-svn-id: https://develop.svn.wordpress.org/trunk@15774 602fd350-edb4-49c9-b593-d223f7449a82
2010-10-11 13:21:08 +00:00
Andrew Nacin 2657fa5a5b Make it explicit that you can set fallback_cb to false in wp_nav_menu.
git-svn-id: https://develop.svn.wordpress.org/trunk@15772 602fd350-edb4-49c9-b593-d223f7449a82
2010-10-11 03:16:45 +00:00
Mark Jaquith b98d713f62 When doing current page highlighting logic, apply untrailingslashit() to everything so that slash additions or omissions still match. fixes #14208. props filosofo
git-svn-id: https://develop.svn.wordpress.org/trunk@15584 602fd350-edb4-49c9-b593-d223f7449a82
2010-09-07 04:17:37 +00:00
Ryan Boren 9b99bf5f5f Fix typo in [15544]
git-svn-id: https://develop.svn.wordpress.org/trunk@15545 602fd350-edb4-49c9-b593-d223f7449a82
2010-08-27 16:53:26 +00:00
Nikolay Bachiyski 33cd9f11dd Make menus manipulation easier for plugin developers
* Add a wp_nav_menu_objects filter, which gets a sorted list of all menu node objects in the currently rendered menu
 * Add current, current_item_ancestor and current_item_parent boolean member variables to each menu node object, which are true when the item has the current-menu-item, current-menu-ancestor or current-menu-parent CSS class respectively


git-svn-id: https://develop.svn.wordpress.org/trunk@15544 602fd350-edb4-49c9-b593-d223f7449a82
2010-08-27 16:13:39 +00:00
Andrew Nacin 0e2a53e8c9 Prevent the same menu item from receiving duplicate IDs if the menu is used twice. All menu items now get a class with their post ID; only the first item now gets an ID. fixes #13976 for trunk.
git-svn-id: https://develop.svn.wordpress.org/trunk@15407 602fd350-edb4-49c9-b593-d223f7449a82
2010-07-13 21:30:59 +00:00
Andrew Nacin 8a0c54e243 Fix typo in php comment. props Utkarsh, fixes #14072.
git-svn-id: https://develop.svn.wordpress.org/trunk@15325 602fd350-edb4-49c9-b593-d223f7449a82
2010-06-25 06:26:40 +00:00
Ryan Boren e8b8d9773a Fix current page detection for home when index.php is in the requested URL. Props filosofo. fixes #13977 for 3.1
git-svn-id: https://develop.svn.wordpress.org/trunk@15320 602fd350-edb4-49c9-b593-d223f7449a82
2010-06-24 17:39:29 +00:00
Andrew Nacin c118ae7ec8 Assign menu-item-home also when menu item isn't current. props filosofo, see #14053 for trunk.
git-svn-id: https://develop.svn.wordpress.org/trunk@15302 602fd350-edb4-49c9-b593-d223f7449a82
2010-06-22 22:05:43 +00:00
Ryan Boren ab9c5796b3 Remove trailing whites
git-svn-id: https://develop.svn.wordpress.org/trunk@15259 602fd350-edb4-49c9-b593-d223f7449a82
2010-06-14 23:39:35 +00:00
Ryan Boren 1a56928cf9 Menu ancestor fixes. Props filosofo. fixes #12812
git-svn-id: https://develop.svn.wordpress.org/trunk@15257 602fd350-edb4-49c9-b593-d223f7449a82
2010-06-14 21:19:55 +00:00
Ryan Boren 82be9621ec Trim trailing whitespace.
git-svn-id: https://develop.svn.wordpress.org/trunk@15235 602fd350-edb4-49c9-b593-d223f7449a82
2010-06-11 20:19:35 +00:00
Ron Rennick f99bbae9b2 add ancestor classes for taxonomy objects, props filosofo, fixes #13831
git-svn-id: https://develop.svn.wordpress.org/trunk@15221 602fd350-edb4-49c9-b593-d223f7449a82
2010-06-11 16:00:29 +00:00
Ryan Boren 64eb8f7159 Allow assigning an empty menu to a location. fixes #13787
git-svn-id: https://develop.svn.wordpress.org/trunk@15184 602fd350-edb4-49c9-b593-d223f7449a82
2010-06-09 22:05:27 +00:00
Ryan Boren 0922715668 Cut 'em out, move 'em on, trailing whitespace
git-svn-id: https://develop.svn.wordpress.org/trunk@15116 602fd350-edb4-49c9-b593-d223f7449a82
2010-06-02 20:04:07 +00:00
Andrew Nacin 7128d1984b Add menu_id to wp_nav_menu() and move container_id to the container. Set the container arg to false to not use a container. fixes #13669
git-svn-id: https://develop.svn.wordpress.org/trunk@15113 602fd350-edb4-49c9-b593-d223f7449a82
2010-06-02 17:04:07 +00:00
Ryan Boren 88f326d1c8 Consolidate nav menu class assignments. Props filosofo. fixes #13664
git-svn-id: https://develop.svn.wordpress.org/trunk@15105 602fd350-edb4-49c9-b593-d223f7449a82
2010-06-02 13:48:26 +00:00
Andrew Nacin d5dd6a6aec Move the Walker_Nav_Menu_Checklist class to admin/includes.
git-svn-id: https://develop.svn.wordpress.org/trunk@15077 602fd350-edb4-49c9-b593-d223f7449a82
2010-05-31 15:47:53 +00:00
Andrew Nacin b19e242aa5 Remove vestigial 'context' code for wp_nav_menu. This was used when we used to use the same function as a theme template tag and admin template function (now we don't.) fixes #13656.
git-svn-id: https://develop.svn.wordpress.org/trunk@15075 602fd350-edb4-49c9-b593-d223f7449a82
2010-05-31 14:54:50 +00:00
Ryan Boren aa561cd06c Unique menu container ids. Props filosofo. fixes #13597
git-svn-id: https://develop.svn.wordpress.org/trunk@15034 602fd350-edb4-49c9-b593-d223f7449a82
2010-05-28 16:32:57 +00:00
Andrew Nacin 9b4a85cdaf Move the "Add Home Link" functionality to a checkbox on the View All tab of the Pages metabox. Also makes it work non-JS. props filosofo, fixes #13213.
git-svn-id: https://develop.svn.wordpress.org/trunk@14971 602fd350-edb4-49c9-b593-d223f7449a82
2010-05-27 02:24:33 +00:00
Andrew Nacin f5f97a46d3 Always pass post ID to the_title filter. props dndrnkrd, fixes #13558
git-svn-id: https://develop.svn.wordpress.org/trunk@14964 602fd350-edb4-49c9-b593-d223f7449a82
2010-05-26 21:30:00 +00:00
Ryan Boren 22cb105416 No default value for pass by ref. Props filosofo. fixes #13553
git-svn-id: https://develop.svn.wordpress.org/trunk@14945 602fd350-edb4-49c9-b593-d223f7449a82
2010-05-26 16:25:29 +00:00
Ryan Boren 6c79e1395d Make classes property for menus an array. Props filosofo. fixes #13551
git-svn-id: https://develop.svn.wordpress.org/trunk@14944 602fd350-edb4-49c9-b593-d223f7449a82
2010-05-26 15:41:21 +00:00