Commit Graph

175 Commits

Author SHA1 Message Date
Sergey Biryukov
d8c50c7a12 Menus: Make sure current-menu-parent and current-menu-ancestor classes are properly set for parent items of post type archive submenu items.
Props mrwweb, ajoah, welcher.
Fixes #39800.
Built from https://develop.svn.wordpress.org/trunk@41008


git-svn-id: http://core.svn.wordpress.org/trunk@40858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-05 21:31:44 +00:00
Drew Jaynes
36759db92e Docs: Clarify accepted types and values for $menu parameters in several contexts:
* `wp_nav_menu()`
* `wp_get_nav_menu_object()` and its filter `wp_get_nav_menu_object`
* `is_nav_menu()`
* `wp_delete_nav_menu()`
* `wp_get_nav_menu_items()`

Props dimadin.
Fixes #38166.

Built from https://develop.svn.wordpress.org/trunk@40969


git-svn-id: http://core.svn.wordpress.org/trunk@40819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-30 04:49:40 +00:00
Adam Silverstein
8b60430aee Customizer: Fix an issue with menu classes in the customizer preview.
In customizer preview, strip changeset uuid in menu urls before comparing with current url to determine menu item classes.

In the customizer, menu items now contain a changeset uuid as part of their urls. Strip the changeset uuid off the url before comparing with current url (which lacks the changeset uuid).

Props priyankabehera155, jipmoors.
Fixes #39758.


Built from https://develop.svn.wordpress.org/trunk@40658


git-svn-id: http://core.svn.wordpress.org/trunk@40521 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-12 20:35:43 +00:00
Sergey Biryukov
59d33e90da Docs: Correct @return value type for wp_nav_menu().
Props chesio.
Fixes #39890.
Built from https://develop.svn.wordpress.org/trunk@40062


git-svn-id: http://core.svn.wordpress.org/trunk@39999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-16 16:09:43 +00:00
Gary Pendergast
fe86e61f0b Menus: Add the menu-item-home class to the static front page item.
When a site is using a static front page, and that page is in a menu, it isn't given the CSS class `menu-item-home`, contrary to the developer documentation.

An incorrect solution was originally added in [35272], and is now gone. Let us never speak of it again.

Props mdgl, adamsilverstein, welcher, pento.
Fixes #35272.


Built from https://develop.svn.wordpress.org/trunk@38940


git-svn-id: http://core.svn.wordpress.org/trunk@38883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 01:58:30 +00:00
Gary Pendergast
efaf9bae66 Menus: Add the menu-item-home class to the static front page.
When a site is using a static front page, and that page is in a menu, it isn't given the CSS class `menu-item-home`, contrary to the developer documentation.

Props christophherr.
Fixes #35272.


Built from https://develop.svn.wordpress.org/trunk@38882


git-svn-id: http://core.svn.wordpress.org/trunk@38825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-24 00:32:32 +00:00
Peter Wilson
6cdab630cd Menus: Improve documentation of new $item_spacing argument.
Adds `@since` tags for and improves description of the new `$item_spacing` argument added to `wp_nav_menu()`, `wp_list_pages()`, and `wp_page_menu()` in [38523].

Props johnbillion for copy.
See #35206.

Built from https://develop.svn.wordpress.org/trunk@38574


git-svn-id: http://core.svn.wordpress.org/trunk@38517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-08 05:32:03 +00:00
John Blackbourn
8bec516c18 Menus: Correct the docblocks for Walker_Nav_Menu, wp_nav_menu(), and walk_nav_menu_tree().
This corrects the parameter type for the `$args` and `$item` parameters passed throughout these functions, class methods, and hooks.

See #24587
See #35206
See #37770

Built from https://develop.svn.wordpress.org/trunk@38559


git-svn-id: http://core.svn.wordpress.org/trunk@38502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-07 16:15:30 +00:00
Peter Wilson
4131900722 Menus: Add white space option to wp_nav_menu() and wp_list_pages().
Adds an `item_spacing` option to the arguments array for the functions `wp_nav_menu()`, `wp_list_pages()`, and `wp_page_menu()`. `item_spacing` is a boolean accepting either `preserve` or `discard`.

Previously, certain CSS choices could result in a site's layout changing if `wp_nav_menu()` fell back to the default `wp_list_pages()` due to differences in the whitespace within the HTML. The new argument ensures a function outputs consistant HTML while maintaining backward compatibility.

Fixes #35206.

Built from https://develop.svn.wordpress.org/trunk@38523


git-svn-id: http://core.svn.wordpress.org/trunk@38464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-06 09:06:31 +00:00
Scott Taylor
a3ffebce30 Bootstrap: do not go gentle into that good night r38411, r38412, and parts of r38389.
See #36335.

Built from https://develop.svn.wordpress.org/trunk@38470


git-svn-id: http://core.svn.wordpress.org/trunk@38411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 16:31:29 +00:00
Scott Taylor
390ceba6c7 Bootstrap: after r38409 and r38410, revert r38402 which reverted r38399.
This fixes the paths in `wp-vendor/` that were including `src`. I want to drop this in so we can find out what else will break.

See #36335.

Built from https://develop.svn.wordpress.org/trunk@38411


git-svn-id: http://core.svn.wordpress.org/trunk@38352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 22:32:37 +00:00
Dion Hulse
0e31a46161 Bootstrap: Revert [38399] as it's broken /build/ and subsequently core.svn.wordpress.org.
The generated classmaps reference `/src/` files and operates in the assumption that the base directory is one level above `wp-settings.php`, which it isn't after our build processes are run.

See #36335

Built from https://develop.svn.wordpress.org/trunk@38402


git-svn-id: http://core.svn.wordpress.org/trunk@38343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 14:37:32 +00:00
Scott Taylor
6a529648cf Bootstrap: Autoload classes using a Composer-generated PHP 5.2-compatible Autoloader.
* `wp-admin` and `wp-includes` are scanned for classes to autoload
* Several 3rd-party and Ryan McCue-shaped libraries are excluded when the classmap is generated, see `composer.json`: `autoload.exclude-from-classmap`
* `wp-vendor/autoload_52.php` is included at the top of `wp-settings.php` - no changes need to be made to unit tests to include the autoloader
* An avalanche of `require()` and `require_once()` calls that loaded class files have been removed from the codebase.

The following files have been added to `svn:ignore` - they are not 5.2-compatible and fail during pre-commit:
* src/wp-vendor/autoload.php
* src/wp-vendor/composer/autoload_real.php
* src/wp-vendor/composer/autoload_static.php
* src/wp-vendor/composer/ClassLoader.php

We favor these files instead:
* src/wp-vendor/autoload_52.php
* src/wp-vendor/composer/autoload_real_52.php
* src/wp-vendor/composer/ClassLoader52.php

When new PHP classes are added to the codebase, simply run `composer install` or `composer update` from the project root to update the autoloader.

The future is now.

See #36335.

Built from https://develop.svn.wordpress.org/trunk@38399


git-svn-id: http://core.svn.wordpress.org/trunk@38340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-27 09:15:29 +00:00
John Blackbourn
f189b72b22 Docs: Alignment after [38369].
See #37770

Built from https://develop.svn.wordpress.org/trunk@38370


git-svn-id: http://core.svn.wordpress.org/trunk@38311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-26 16:51:28 +00:00
John Blackbourn
94c8ca0f2e Docs: Correct various documentation around object and stdClass types.
See #37770

Built from https://develop.svn.wordpress.org/trunk@38369


git-svn-id: http://core.svn.wordpress.org/trunk@38310 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-26 16:49:45 +00:00
Drew Jaynes
5415629ad2 Nav Menus: Move the Walker_Nav_Menu class to its own file.
The new class-walker-nav-menu.php file is loaded in nav-menu-template.php for backward compatibility purposes.

Fixes #37035. See #33413.

Built from https://develop.svn.wordpress.org/trunk@37640


git-svn-id: http://core.svn.wordpress.org/trunk@37608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-06 15:18:31 +00:00
Drew Jaynes
2c7f5217cd Docs: Relocate some @see tags and add missing @access tags to method and property DocBlocks in Walker_Nav_Menu.
See #32246.

Built from https://develop.svn.wordpress.org/trunk@37639


git-svn-id: http://core.svn.wordpress.org/trunk@37607 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-06 05:47:27 +00:00
Drew Jaynes
16b51fb44d Docs: Reformat several parameter descriptions in Walker_Nav_Menu to directly reference wp_nav_menu() rather than use inline @see tags.
See #32246.

Built from https://develop.svn.wordpress.org/trunk@37638


git-svn-id: http://core.svn.wordpress.org/trunk@37606 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-06 05:45:28 +00:00
Drew Jaynes
318f745808 Docs: Correct DocBlock descriptions for the $before, $after, $link_before, and $link_after arguments for wp_nav_menu().
* `$before` falls before the link markup starts
* `$after` falls after the link markup ends
* `$link_before` falls before the link text
* `$link_after` falls after the link text

Props wp_smith for the initial patch.

See #32246.

Built from https://develop.svn.wordpress.org/trunk@37561


git-svn-id: http://core.svn.wordpress.org/trunk@37529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-25 16:17:27 +00:00
Drew Jaynes
9193013158 Docs: Apply inline @see tags to hooks referenced in DocBlocks in a variety of wp-includes/* files.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as actions and filters.

Fixes #36921.

Built from https://develop.svn.wordpress.org/trunk@37544


git-svn-id: http://core.svn.wordpress.org/trunk@37512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 19:02:28 +00:00
Drew Jaynes
e78209267f Docs: Standardize filter docs in wp-includes/nav-menu-template.php to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

Built from https://develop.svn.wordpress.org/trunk@37500


git-svn-id: http://core.svn.wordpress.org/trunk@37468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:28:27 +00:00
Drew Jaynes
fe3b007fdd Docs: Remove inline @see tags from function, class, and method references in inline docs.
Known functions, classes, and methods are now auto-linked in Code Reference pages following #meta1483.

Note: Hook references are still linked via inline `@see` tags due to the unlikelihood of reliably matching for known hooks based on a RegEx pattern.

See #32246.

Built from https://develop.svn.wordpress.org/trunk@37342


git-svn-id: http://core.svn.wordpress.org/trunk@37308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-02 04:00:28 +00:00
Konstantin Obenland
6c54bf4dcb Menus: Bring back line break between menu items.
While removing line breaks was great for all use cases except justified menu
items, it broke menus with justified menu items.
Reverts [34321].

Props wp-architect.
Fixes #35107.


Built from https://develop.svn.wordpress.org/trunk@36081


git-svn-id: http://core.svn.wordpress.org/trunk@36046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-24 00:21:27 +00:00
Scott Taylor
dc1e85a540 Nav Menus: show custom post type Archive item at the top of the View All tab for the post type on the legacy Nav Menu screen.
Props aaroncampbell, DrewAPicture, seanchayes, hlashbrooke, paulwilde, ericlewis, raulillana
See #16075.

Built from https://develop.svn.wordpress.org/trunk@35382


git-svn-id: http://core.svn.wordpress.org/trunk@35346 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-24 17:46:25 +00:00
John Blackbourn
51667f882a Add a nav_menu_item_title filter for filtering nav menu item titles.
Fixes #33447
Props paulwilde

Built from https://develop.svn.wordpress.org/trunk@34666


git-svn-id: http://core.svn.wordpress.org/trunk@34630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-28 18:41:26 +00:00
Scott Taylor
d6774f0f6d Nav Menus: in wp_nav_menu(), $container is already bound to a list of allowed tags. PHP, being its whimsical self, while return true if someone sets $container to true via in_array( true, [ 'div', 'nav' ] ). Check that $container is a string before the in_array() check. 'true' does not pass.
Props shedonist for the original patch.
Fixes #32464.

Built from https://develop.svn.wordpress.org/trunk@34630


git-svn-id: http://core.svn.wordpress.org/trunk@34594 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-27 18:13:24 +00:00
John Blackbourn
aa35e473f7 callback is not a valid type in PHP, PSR-5, or phpDocumentor. callable should be used instead.
Fixes #34032

Built from https://develop.svn.wordpress.org/trunk@34566


git-svn-id: http://core.svn.wordpress.org/trunk@34530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 23:58:25 +00:00
John Blackbourn
cb740147be Add $depth as a parameter in the nav_menu_item_args filter.
Fixes #29417

Built from https://develop.svn.wordpress.org/trunk@34507


git-svn-id: http://core.svn.wordpress.org/trunk@34471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 17:59:24 +00:00
Drew Jaynes
90f61eff52 Docs: Add a summary to the hook doc for the nav_menu_item_args filter, introduced in [34471].
Fixes #29417.

Built from https://develop.svn.wordpress.org/trunk@34481


git-svn-id: http://core.svn.wordpress.org/trunk@34445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 05:09:24 +00:00
Scott Taylor
0c1f92e301 Nav Menus: Add a 'nav_menu_item_args' filter to Walker_Nav_Menu::start_el().
Props bjornjohansen.
Fixes #29417.

Built from https://develop.svn.wordpress.org/trunk@34471


git-svn-id: http://core.svn.wordpress.org/trunk@34435 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 03:17:24 +00:00
Konstantin Obenland
8d8252aa89 Menus: Remove whitespace between nav menu items.
Avoids CSS hacks like floating menu items or setting the parent element's
font-size to 0 in order to display nav menus horizontally.

Props jjeaton.
Fixes #27762.


Built from https://develop.svn.wordpress.org/trunk@34321


git-svn-id: http://core.svn.wordpress.org/trunk@34285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-19 11:40:26 +00:00
Sergey Biryukov
78d43de7e4 Avoid PHP notices in redirect_canonical() and _wp_menu_item_classes_by_context() if $_SERVER['HTTP_HOST'] is not set.
fixes #32229.
Built from https://develop.svn.wordpress.org/trunk@33775


git-svn-id: http://core.svn.wordpress.org/trunk@33743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-28 03:31:20 +00:00
Weston Ruter
2678bd9225 Customizer: Restore default fallback_cb arg for wp_nav_menu() calls in customizer preview.
Props ocean90, westonruter.
Fixes #33218.

Built from https://develop.svn.wordpress.org/trunk@33585


git-svn-id: http://core.svn.wordpress.org/trunk@33552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-04 21:57:25 +00:00
Dion Hulse
ffb1de37ae Ensure that Custom Links in menu's are marked as current regardless of their scheme.
Props McGuive7, marsjaninzmarsa.
Fixes #32221

Built from https://develop.svn.wordpress.org/trunk@33103


git-svn-id: http://core.svn.wordpress.org/trunk@33074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-07 09:57:26 +00:00
Sergey Biryukov
52db28396c Customizer: Avoid PHP notices after [32806].
props adamsilverstein, westonruter.
fixes #32781.
Built from https://develop.svn.wordpress.org/trunk@33035


git-svn-id: http://core.svn.wordpress.org/trunk@33006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-01 19:08:24 +00:00
Scott Taylor
0cc29d8bb7 In wp_nav_menu(), ensure that the $menu arg is populated when passed to filters.
Props greuben, chriscct7.
Fixes #16594.

Built from https://develop.svn.wordpress.org/trunk@32803


git-svn-id: http://core.svn.wordpress.org/trunk@32774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-16 20:33:25 +00:00
Dominik Schilling
8dcd236ba3 Nav menus: Reset the fallback_cb default argument in wp_nav_menu in case of a Customizer preview.
props westonruter.
see #32576.
Built from https://develop.svn.wordpress.org/trunk@32763


git-svn-id: http://core.svn.wordpress.org/trunk@32734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-14 17:14:24 +00:00
Scott Taylor
cb0b0b109d Fix doc blocks for nav-menu*.php files.
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32612


git-svn-id: http://core.svn.wordpress.org/trunk@32582 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-26 22:10:25 +00:00
Scott Taylor
fc843ce4d0 There are some random add_action() and add_filter() calls littered around some files in wp-includes/. These should be moved to wp-includes/default-filters.php with the rest of the registered hooks. It seems like this was the best practice for awhile and then we randomly stopped. This file loads way before any of the includes, so the hooks will be registered for any request that loads WordPress, even SHORTINIT - a lot of the hooks registered won't run anyways (that's already the case).
See #30947.

Built from https://develop.svn.wordpress.org/trunk@31168


git-svn-id: http://core.svn.wordpress.org/trunk@31149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-12 16:40:23 +00:00
Drew Jaynes
c31f6c11e9 4.1 Docs Audit: Spell out HTML element names in DocBlock summaries for the nav_menu_css_class, nav_menu_item_id, and nav_menu_link_attributes filters.
Due to a recent clarification in the core inline documentation standards, HTML tags are no longer allowed in DocBlock summaries as they wreak havoc on displaying pages in the official Code Reference. See #30473.

See #30469.

Built from https://develop.svn.wordpress.org/trunk@30618


git-svn-id: http://core.svn.wordpress.org/trunk@30608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-28 12:12:23 +00:00
John Blackbourn
8f219ed949 Revert [30032] so appropriate PHP warnings aren't masked.
Fixes #28743

Built from https://develop.svn.wordpress.org/trunk@30592


git-svn-id: http://core.svn.wordpress.org/trunk@30582 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-28 01:29:23 +00:00
Drew Jaynes
9955384dbe Ensure inline code is markdown-escaped as such, HTML tags are removed from summaries, and that code snippets in descriptions are properly indented.
Affects DocBlocks for the following core elements:
* Backtick-escape an HTML tag in the description for the `media_upload_mime_type_links()` hook
* Backtick-escape inline code in the description for `wp_get_active_network_plugins()`
* Remove HTML tags from the summaries for the `nav_menu_css_class`, `nav_menu_item_id`, and `nav_menu_link_attributes` hooks
* Backtick-escape HTML tags, add inline `@see` tags to parameter descriptions for the `nav_menu_css_class`, `nav_menu_item_id`, and `nav_menu_link_attributes` hooks

Props rarst.
See #30473.

Built from https://develop.svn.wordpress.org/trunk@30543


git-svn-id: http://core.svn.wordpress.org/trunk@30532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-24 05:53:22 +00:00
Drew Jaynes
fd1f5bb3ad Update the DocBlock changelogs for the nav_menu_css_class, nav_menu_item_id, and nav_menu_link_attributes hooks following [30358], where $depth parameters were added.
Props kpdesign.
See [30358]. Fixes #19064.

Built from https://develop.svn.wordpress.org/trunk@30485


git-svn-id: http://core.svn.wordpress.org/trunk@30474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-20 18:26:23 +00:00
John Blackbourn
96e57d411b Add $depth parameter to the nav_menu_css_class, nav_menu_item_id, and nav_menu_link_attributes filters.
Fixes #19064
Props cyclometh, chriscct7, johnbillion

Built from https://develop.svn.wordpress.org/trunk@30358


git-svn-id: http://core.svn.wordpress.org/trunk@30357 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-16 07:37:22 +00:00
Mark Jaquith
11471d6415 Cast class names to an array to avoid a potential warning.
props briandichiara
fixes #29743
Built from https://develop.svn.wordpress.org/trunk@30032


git-svn-id: http://core.svn.wordpress.org/trunk@30032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-26 23:19:19 +00:00
Sergey Biryukov
504d4ad5eb Change the default orderby value in wp_get_nav_menus() to 'name'.
props voldemortensen, igmoweb.
fixes #29460.
Built from https://develop.svn.wordpress.org/trunk@29792


git-svn-id: http://core.svn.wordpress.org/trunk@29564 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 15:45:16 +00:00
Scott Taylor
0005433983 Correct a few @param docs for $walker.
Props dnaber-de.
Fixes #29011.

Built from https://develop.svn.wordpress.org/trunk@29293


git-svn-id: http://core.svn.wordpress.org/trunk@29075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-24 22:25:16 +00:00
Sergey Biryukov
819d4f972c Correct filter documentation in wp_nav_menu().
props dlh.
fixes #28657.
Built from https://develop.svn.wordpress.org/trunk@28867


git-svn-id: http://core.svn.wordpress.org/trunk@28667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-27 03:37:16 +00:00
Scott Taylor
cc0c90e05a When selecting a fallback menu in wp_nav_menu(), the "first" menu is retrieved from an unsorted query. When retrieving a fallback menu, pass array( 'orderby' => 'name' ) to wp_get_nav_menus() to return a menu consistently.
Props lukecarbis.
Fixes #28126.

Built from https://develop.svn.wordpress.org/trunk@28826


git-svn-id: http://core.svn.wordpress.org/trunk@28630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-24 17:25:15 +00:00
Scott Taylor
dfa4de15fa Add missing access modifiers to methods/members in Walker and subclasses. Add a magic __get() method.
See #27881, #22234.

Built from https://develop.svn.wordpress.org/trunk@28514


git-svn-id: http://core.svn.wordpress.org/trunk@28340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 06:00:15 +00:00