Commit Graph

302 Commits

Author SHA1 Message Date
John Blackbourn
4981452aba General: Fix more instances of inconsistent parameters passed to various filters, plus fix some filter docs.
See #38462, #41017

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


git-svn-id: http://core.svn.wordpress.org/trunk@41061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-03 16:13:44 +00:00
Drew Jaynes
dfab72aa35 Docs: Default for the orderby argument in wp_list_categories() is actually 'name', not 'ID'.
Props uicestone.
See #41017.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-12 22:06:39 +00:00
Boone Gorges
736e6a2977 Simplify documentation for wp_dropdown_categories().
Props ArnaudBan.
Fixes #41058.
Built from https://develop.svn.wordpress.org/trunk@40903


git-svn-id: http://core.svn.wordpress.org/trunk@40753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-15 09:39:42 +00:00
Andrea Fercia
bdad500af7 Widgets: Remove the title attributes used in the Tag cloud widget.
- improves accessibility using an aria-label attribute to match the information conveyed visually with the one exposed to assistive technologies
- adds an option in the widget to display the item counts, consistently with what other widgets already do (Archives, Categories)

Props adamsoucie, emirpprime, Samantha Miller., MikeLittle, rianrietveld, sami.keijonen, adamsilverstein, westonruter, afercia.
See #24766.
Fixes #35566.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-22 20:24:41 +00:00
Sergey Biryukov
47aab2faad Docs: Clarify that get_the_category_list() and the_category() display links as an unordered list by default.
See #39130.
Built from https://develop.svn.wordpress.org/trunk@40043


git-svn-id: http://core.svn.wordpress.org/trunk@39980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-05 15:16:44 +00:00
Sergey Biryukov
9d7ea04936 I18N: Merge similar strings in _deprecated_argument() calls.
Add translator comments.

Props ramiy, SergeyBiryukov.
Fixes #39020.
Built from https://develop.svn.wordpress.org/trunk@40028


git-svn-id: http://core.svn.wordpress.org/trunk@39965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-29 11:50:41 +00:00
John Blackbourn
80a839de13 Docs: Misc corrections and additions to inline documentation.
See #39130
Props keesiemeijer

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


git-svn-id: http://core.svn.wordpress.org/trunk@39579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-27 09:28:40 +00:00
John Blackbourn
d327c92e4b Docs: Add and correct @since docs for a variety of functions and methods.
Props keesiemeijer, chris_dev
Fixes #39343, #39357, #39344
See #39130

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


git-svn-id: http://core.svn.wordpress.org/trunk@39578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-27 09:21:44 +00:00
Boone Gorges
aa644128d6 Taxonomy: Use get_term_link() instead of get_category_link() in get_term_parents_list().
`get_category_link()` is a wrapper for `get_term_link()`. Using the
unwrapped function makes more sense semantically (it's taxonomy-
agnostic) and it's also more parsimonious (the `WP_Error` check in
`get_category_link()` is redundant with similar checks just before
in `get_term_link()`).

Props keesiemeijer.
Fixes #17069.
Built from https://develop.svn.wordpress.org/trunk@39593


git-svn-id: http://core.svn.wordpress.org/trunk@39533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-13 02:57:41 +00:00
Boone Gorges
74b6e1ba86 Taxonomy: Introduce get_term_parents_list().
This new function is a taxonomy-agnostic version of `get_category_parents()`.

Props keesiemeijer, SergeyBiryukov, rafaehlers.
Fixes #17069.
Built from https://develop.svn.wordpress.org/trunk@39549


git-svn-id: http://core.svn.wordpress.org/trunk@39489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-09 16:10:42 +00:00
John Blackbourn
042d09001a Taxonomy: Correct the type for the first parameter of the the_category filter.
See #39130

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


git-svn-id: http://core.svn.wordpress.org/trunk@39470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-07 01:23:42 +00:00
Sergey Biryukov
480501c6a8 Taxonomy: Prevent wp_list_categories() from producing not well-nested output if hide_title_if_empty is true.
Props chesio.
Fixes #38839. See #33460.
Built from https://develop.svn.wordpress.org/trunk@39280


git-svn-id: http://core.svn.wordpress.org/trunk@39220 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-17 18:02:30 +00:00
Dominik Schilling
7cce73a634 General: Introduce a wp_list_sort() helper function, v2.
In addition to `wp_list_filter()` for filtering a list of objects, and `wp_list_pluck()` for plucking a certain field out of each object in a list, this new function can be used for sorting a list of objects by specific fields. These functions are now all contained within the new `WP_List_Util()` class and `wp_list_sort()` is used in various parts of core for sorting lists.

This was previously committed in [38859] but got reverted in [38862] and [38863]. To fix the previous issues, `wp_list_sort()` supports now an additional argument to preserve array keys via `uasort()`.

Props flixos90, DrewAPicture, jorbin.
Fixes #37128.
Built from https://develop.svn.wordpress.org/trunk@38928


git-svn-id: http://core.svn.wordpress.org/trunk@38871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-25 21:26:32 +00:00
Dominik Schilling
6c8508023f Revert [38859] due to an incomplete implementation.
See https://core.trac.wordpress.org/ticket/37128#comment:27.
See #37128.
Built from https://develop.svn.wordpress.org/trunk@38863


git-svn-id: http://core.svn.wordpress.org/trunk@38806 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-21 17:01:32 +00:00
Pascal Birchler
f54558e75b General: Introduce a wp_list_sort() helper function.
In addition to `wp_list_filter()` for filtering a list of objects, and `wp_list_pluck()` for plucking a certain field out of each object in a list, this new function can be used for sorting a list of objects by specific fields. These functions are now all contained within the new `WP_List_Util()` class and `wp_list_sort()` is used in various parts of core for sorting lists.

Props flixos90, DrewAPicture, jorbin.
Fixes #37128.
Built from https://develop.svn.wordpress.org/trunk@38859


git-svn-id: http://core.svn.wordpress.org/trunk@38802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-21 11:12:51 +00:00
Sergey Biryukov
ec5782bed5 Docs: Fix typo in in_category() description.
Props Kenshino, mbootsman.
Fixes #38363.
Built from https://develop.svn.wordpress.org/trunk@38828


git-svn-id: http://core.svn.wordpress.org/trunk@38771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 13:46:44 +00:00
Andrea Fercia
7be7d396f1 Editor: Add a role button to the Tags meta box tag cloud links.
For better accessibility, the tag cloud links in the Tags meta box should be
reported to assistive technologies as buttons. They don't navigate to a new
resource, instead they perform an action.

Fixes #38318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-16 20:09:28 +00:00
Dion Hulse
f40c2a62a6 Taxonomy: Avoid a fatal error in the_tags() in the event that get_the_term_list() returns a WP_Error.
Props michalzuber.
See #37291.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-11 03:27:31 +00:00
Drew Jaynes
22adda2aa0 Hooks: Standardize naming of dynamic hooks to use interpolation vs concatenation.
Benefits gained in discoverability and self-documentation throughout core trump the negligible performance hit in using interpolation in hook names.

Props ramiy.
See #37748.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-22 18:25:31 +00:00
Drew Jaynes
6cc13f0c54 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 1/2.

See #37318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 16:57:32 +00:00
Sergey Biryukov
139387b7e5 Docs: Use 3-digit, x.x.x-style semantic versioning for _doing_it_wrong(), _deprecated_function(), _deprecated_argument(), and _deprecated_file() throughout core.
Props metodiew.
Fixes #36495.
Built from https://develop.svn.wordpress.org/trunk@37985


git-svn-id: http://core.svn.wordpress.org/trunk@37926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 12:40:29 +00:00
Drew Jaynes
5e5f5dd4e9 Docs: Improve return descriptions for get_the_category() and get_the_term() to specifically notate that an array of WP_Term objects is returned on success.
See #32246. 

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


git-svn-id: http://core.svn.wordpress.org/trunk@37583 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-01 22:46:28 +00:00
Drew Jaynes
3beb18d4f4 Docs: Improve documentation for wp_generate_tag_cloud() default arguments by formatting them into in a hash-notation.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-27 18:00:28 +00:00
Boone Gorges
253686fae6 Store only term IDs in object term relationships caches.
Previously, objects containing all data about a term were stored in each
object's term cache. Besides being wasteful, this approach caused invalidation
issues, as when a modified term count required a flush for all objects
belonging to the term.

Backward compatibility is maintained for plugins that continue to put object
data directly into the `{$taxonomy}_relationships` cache bucket.

Fixes #36814.
Built from https://develop.svn.wordpress.org/trunk@37573


git-svn-id: http://core.svn.wordpress.org/trunk@37541 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-26 04:50:27 +00:00
Drew Jaynes
b9ed1cb665 Docs: Reorder argument descriptions in the DocBlock for wp_list_categories() to match the default arguments list and improve reading at a glance.
Props birgire for the initial patch.
Fixes #36693.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37539 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-25 19:40:27 +00:00
Drew Jaynes
6c34bf08a1 Docs: Add missing documentation for the style argument in the DocBlock for wp_list_categories().
Props birgire for the initial patch.
See #36693.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-25 19:35:37 +00:00
Drew Jaynes
da78aeffe9 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.

See #36921.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 18:59:27 +00:00
Drew Jaynes
c8c44a3111 Docs: Standardize filter docs in wp-includes/category-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@37496


git-svn-id: http://core.svn.wordpress.org/trunk@37464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:25:52 +00:00
Drew Jaynes
f52a8cb1fa Docs: Remove/replace invalid inline @link tags in DocBlocks in wp-includes/*.
Fixes #36910.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 17:39:28 +00:00
Drew Jaynes
549e33a599 Docs: Remove several invalid inline @link tags from the DocBlock for wp_list_categories().
See #36910.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37454 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 17:24:28 +00:00
Boone Gorges
03fa635ba7 Introduce required argument for wp_dropdown_categories().
This allows the HTML5 `required` attribute to be added to the `select` element.

Props wzislam, pcarvalho.
Fixes #31909.
Built from https://develop.svn.wordpress.org/trunk@37465


git-svn-id: http://core.svn.wordpress.org/trunk@37433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-19 02:39:27 +00:00
Boone Gorges
805a1ebadb Beautify, simplify, lovelify, alignify the default argument array in wp_dropdown_categories().
See #31909.
Built from https://develop.svn.wordpress.org/trunk@37463


git-svn-id: http://core.svn.wordpress.org/trunk@37431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-19 02:17:27 +00:00
John Blackbourn
e56457f7fe Taxonomy: Correct the accetped types for the taxonomy element in the arguments passed to wp_dropdown_categories().
Props grapplerulrich
Fixes #35446

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


git-svn-id: http://core.svn.wordpress.org/trunk@36256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-13 20:16:29 +00:00
Pascal Birchler
25ca04b95f Docs: Improve readability of the default arguments of wp_list_categories().
Adds missing documentation for the `separator` argument introduced in [35140].

Props birgire for initial patch.
Fixes #34751.
Built from https://develop.svn.wordpress.org/trunk@36135


git-svn-id: http://core.svn.wordpress.org/trunk@36101 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-31 11:30:27 +00:00
Drew Jaynes
05e0d7c3c3 Docs: Add missing parameter and return descriptions to the DocBlocks for _wp_object_name_sort_cb() and _wp_object_count_sort_cb(), both uasort() callbacks.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-18 23:38:26 +00:00
Boone Gorges
b2f4f73633 Ensure that wp_list_categories() supports comma-separated lists for 'exclude' and 'exclude_tree'.
[34696] introduced a regression whereby comma-separated values for 'exclude'
and 'exclude_tree' would be handled improperly when merging the two parameters,
resulting in category IDs being incorrectly dropped from the combined array.

Props gblsm, hnle.
Fixes #35156.
Built from https://develop.svn.wordpress.org/trunk@36005


git-svn-id: http://core.svn.wordpress.org/trunk@35970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-18 18:12:25 +00:00
Boone Gorges
20651de171 Introduce 'tag-link-position-x' class to tag cloud links.
The new class describes the cardinal position of a link in the cloud, allowing
more fine-grained CSS and JS targeting.

Props Mte90, chmac.
Fixes #5172.
Built from https://develop.svn.wordpress.org/trunk@35984


git-svn-id: http://core.svn.wordpress.org/trunk@35949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-17 16:27:28 +00:00
Boone Gorges
812060f940 Improve handling for WP_Error objects in get_the_terms().
`wp_get_object_terms()` can return a `WP_Error` object. As such, the
`get_the_terms()` cache wrapper should handle them properly. To wit:

* Don't try to map an error object to `get_term()`. Introduced in [35032].
* Don't cache an error object as taxonomy relationships. Introduced in at least [16487], maybe earlier.

Props stephenharris.
Fixes #34723.
Built from https://develop.svn.wordpress.org/trunk@35850


git-svn-id: http://core.svn.wordpress.org/trunk@35814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-10 03:35:27 +00:00
Sergey Biryukov
b8e250927f In wp_list_categories(), rewrite a long condition for clarity.
See #34363.
Built from https://develop.svn.wordpress.org/trunk@35293


git-svn-id: http://core.svn.wordpress.org/trunk@35259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-20 16:13:26 +00:00
Boone Gorges
b285b3002a Correct inline comment in wp_list_categories().
The fallback link for the 'All' option is 'page_for_posts', not
'page_on_front'. Introduced in [32292].

Props sudar, SergeyBiryukov.
Fixes #34363.
Built from https://develop.svn.wordpress.org/trunk@35291


git-svn-id: http://core.svn.wordpress.org/trunk@35257 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-20 12:55:27 +00:00
Drew Jaynes
2e11f8cc16 Taxonomy: Improve deprecated argument strings for the 'link' type in get_categories() and wp_dropdown_categories().
Props swissspidy, gagan0123.
Fixes #34318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-18 15:35:24 +00:00
Scott Taylor
296671abcc Taxonomy: in wp_list_categories(), add an arg: separator, to allow the overriding of <br/>.
Props wojtek.szkutnik.
Fixes #9025.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-13 17:02:25 +00:00
Boone Gorges
499d1b74ba Don't cache WP_Term objects in wp_get_object_cache().
The data stored in the cache should be raw database query results, not
`WP_Term` objects (which may be modified by plugins, and may contain additional
properties that shouldn't be cached).

If term relationships caches were handled in `wp_get_object_terms()` - where
a database query takes place - it would be straightforward to cache raw data.
See #34239. Since, in fact, `get_the_terms()` caches the value it gets from
`wp_get_object_terms()`, we need a technique that allows us to get raw data
from a `WP_Term` object. Mirroring `WP_User`, we introduce a `data` property
on term objects, which `get_the_terms()` uses to fetch cacheable term info.

Fixes #34262.
Built from https://develop.svn.wordpress.org/trunk@35032


git-svn-id: http://core.svn.wordpress.org/trunk@34997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 15:13:48 +00:00
Boone Gorges
5b32e27a00 Fix 'exclude_tree' in wp_list_categories().
The 'exclude_tree' parameter must be compatible with 'hierarchical';
previously, 'hierarchical' canceled it out. This changeset also makes it so
that 'exclude_tree' is compatible with 'exclude'. When both are passed, and
'hierarchical' is true, the descendant trees of terms in both parameters will
be excluded from matched terms.

Props tott, webord, MikeHansenMe.
Fixes #12981.
Built from https://develop.svn.wordpress.org/trunk@34696


git-svn-id: http://core.svn.wordpress.org/trunk@34660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-29 19:12:27 +00:00
Boone Gorges
c243d7070e Introduce 'the_category_list' filter.
Used to filter categories as structured data, before building markup in
`get_the_category_list()`.

We use this filter in addition to upstream filters (such as
'get_the_categories'`) because those upstream filters are used in numerous
contexts, while `'the_category_list'` is always used for generating markup
for display.

Props KevinB, ericlewis, SergeyBiryukov, DrewAPicture.
Fixes #9227.
Built from https://develop.svn.wordpress.org/trunk@34625


git-svn-id: http://core.svn.wordpress.org/trunk@34589 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-27 02:22:24 +00:00
Boone Gorges
1ae565455b Pass the post ID to the get_the_categories filter.
Props SergeyBiryukov.
See #9227.
Built from https://develop.svn.wordpress.org/trunk@34624


git-svn-id: http://core.svn.wordpress.org/trunk@34588 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-27 02:17:25 +00:00
Drew Jaynes
6e350ff16e Docs: Clarify the file header summary and version for wp-includes/category-template.php.
See #33413. See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 14:23:24 +00:00
Scott Taylor
172e37b007 Move Walker_Category and Walker_CategoryDropdown into their own files via svn cp. Remove them from category-template.php. Load them in category.php. svn cp category.php over to category-functions.php, which also loads now in category.php.
See #33413.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34078 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-14 03:10:24 +00:00
Boone Gorges
7f5a8e6680 In wp_list_categories(), 'current_category' should accept an array of values.
This allows the 'current-cat' or 'current-cat-parent' classes to be applied
to more than one item in the list.

Props vilkatis.
Fixes #33565.
Built from https://develop.svn.wordpress.org/trunk@33804


git-svn-id: http://core.svn.wordpress.org/trunk@33772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-29 19:46:23 +00:00
Boone Gorges
8670349f70 Rename param added to wp_list_categories() in [33764] to 'hide_title_if_empty'.
Props vilkatis, DrewAPicture.
Fixes #33565.
Built from https://develop.svn.wordpress.org/trunk@33767


git-svn-id: http://core.svn.wordpress.org/trunk@33735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-27 02:09:21 +00:00