Make WordPress Core

Changeset 48103


Ignore:
Timestamp:
06/20/2020 11:20:25 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Docs: Synchronize and correct the documentation for wp_nav_menu() arguments in bundled themes.

See #49572.

Location:
trunk/src/wp-content/themes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfifteen/functions.php

    r47808 r48103  
    492492 * @since Twenty Fifteen 1.0
    493493 *
    494  * @param string  $item_output The menu item output.
    495  * @param WP_Post $item        Menu item object.
    496  * @param int     $depth       Depth of the menu.
    497  * @param array   $args        wp_nav_menu() arguments.
     494 * @param string   $item_output The menu item's starting HTML output.
     495 * @param WP_Post  $item        Menu item data object.
     496 * @param int      $depth       Depth of the menu. Used for padding.
     497 * @param stdClass $args        An object of wp_nav_menu() arguments.
    498498 * @return string Menu item with possible description.
    499499 */
  • trunk/src/wp-content/themes/twentynineteen/inc/icon-functions.php

    r48101 r48103  
    3232 * Display SVG icons in social links menu.
    3333 *
    34  * @param  string  $item_output The menu item output.
    35  * @param  WP_Post $item        Menu item object.
    36  * @param  int     $depth       Depth of the menu.
    37  * @param  object  $args        wp_nav_menu() arguments.
     34 * @param string   $item_output The menu item's starting HTML output.
     35 * @param WP_Post  $item        Menu item data object.
     36 * @param int      $depth       Depth of the menu. Used for padding.
     37 * @param stdClass $args        An object of wp_nav_menu() arguments.
    3838 * @return string The menu item output with social icon.
    3939 */
     
    5555 * Add a dropdown icon to top-level menu items.
    5656 *
    57  * @param string $output Nav menu item start element.
    58  * @param object $item   Nav menu item.
    59  * @param int    $depth  Depth.
    60  * @param object $args   Nav menu args.
     57 * @param string   $item_output The menu item's starting HTML output.
     58 * @param WP_Post  $item        Menu item data object.
     59 * @param int      $depth       Depth of the menu. Used for padding.
     60 * @param stdClass $args        An object of wp_nav_menu() arguments.
    6161 * @return string Nav menu item start element.
    62  * Add a dropdown icon to top-level menu items
    6362 */
    64 function twentynineteen_add_dropdown_icons( $output, $item, $depth, $args ) {
     63function twentynineteen_add_dropdown_icons( $item_output, $item, $depth, $args ) {
    6564
    6665    // Only add class to 'top level' items on the 'primary' menu.
    6766    if ( ! isset( $args->theme_location ) || 'menu-1' !== $args->theme_location ) {
    68         return $output;
     67        return $item_output;
    6968    }
    7069
     
    7877
    7978        // Replace opening <a> with <button>.
    80         $output = preg_replace(
     79        $item_output = preg_replace(
    8180            '/<a\s.*?>/',
    8281            $link,
    83             $output,
     82            $item_output,
    8483            1 // Limit.
    8584        );
    8685
    8786        // Replace closing </a> with </button>.
    88         $output = preg_replace(
     87        $item_output = preg_replace(
    8988            '#</a>#i',
    9089            '</button>',
    91             $output,
     90            $item_output,
    9291            1 // Limit.
    9392        );
     
    9897        $icon = twentynineteen_get_icon_svg( 'keyboard_arrow_down', 24 );
    9998
    100         $output .= sprintf(
     99        $item_output .= sprintf(
    101100            '<button class="submenu-expand" tabindex="-1">%s</button>',
    102101            $icon
     
    104103    }
    105104
    106     return $output;
     105    return $item_output;
    107106}
    108107add_filter( 'walker_nav_menu_start_el', 'twentynineteen_add_dropdown_icons', 10, 4 );
  • trunk/src/wp-content/themes/twentyseventeen/inc/icon-functions.php

    r48101 r48103  
    118118 * Display SVG icons in social links menu.
    119119 *
    120  * @param  string  $item_output The menu item output.
    121  * @param  WP_Post $item        Menu item object.
    122  * @param  int     $depth       Depth of the menu.
    123  * @param  object  $args        wp_nav_menu() arguments.
     120 * @param string   $item_output The menu item's starting HTML output.
     121 * @param WP_Post  $item        Menu item data object.
     122 * @param int      $depth       Depth of the menu. Used for padding.
     123 * @param stdClass $args        An object of wp_nav_menu() arguments.
    124124 * @return string The menu item output with social icon.
    125125 */
     
    144144 * Add dropdown icon if menu item has children.
    145145 *
    146  * @param  string  $title The menu item's title.
    147  * @param  WP_Post $item  The current menu item.
    148  * @param  object  $args  An array of wp_nav_menu() arguments.
    149  * @param  int     $depth Depth of menu item. Used for padding.
     146 * @param string   $title The menu item's title.
     147 * @param WP_Post $item  The current menu item.
     148 * @param stdClass $args  An object of wp_nav_menu() arguments.
     149 * @param int      $depth Depth of menu item. Used for padding.
    150150 * @return string The menu item's title with dropdown icon.
    151151 */
  • trunk/src/wp-content/themes/twentytwenty/inc/template-tags.php

    r48102 r48103  
    500500 * styling of sub levels in the fallback. Only applied if the match_menu_classes argument is set.
    501501 *
    502  * @param array  $css_class CSS Class names.
    503  * @param string $item Comment.
    504  * @param int    $depth Depth of the current comment.
    505  * @param array  $args An array of arguments.
    506  * @param string $current_page Whether or not the item is the current item.
    507  * @return array $css_class CSS Class names.
    508  */
    509 function twentytwenty_filter_wp_list_pages_item_classes( $css_class, $item, $depth, $args, $current_page ) {
     502 * @param string[] $css_class    An array of CSS classes to be applied to each list item.
     503 * @param WP_Post  $page         Page data object.
     504 * @param int      $depth        Depth of page, used for padding.
     505 * @param array    $args        An array of arguments.
     506 * @param int      $current_page ID of the current page.
     507 * @return array CSS class names.
     508 */
     509function twentytwenty_filter_wp_list_pages_item_classes( $css_class, $page, $depth, $args, $current_page ) {
    510510
    511511    // Only apply to wp_list_pages() calls with match_menu_classes set to true.
     
    535535 * Adds a Sub Nav Toggle to the Expanded Menu and Mobile Menu.
    536536 *
    537  * @param stdClass $args An array of arguments.
    538  * @param string   $item Menu item.
    539  * @param int      $depth Depth of the current menu item.
    540  * @return stdClass $args An object of wp_nav_menu() arguments.
     537 * @param stdClass $args  An object of wp_nav_menu() arguments.
     538 * @param WP_Post  $item  Menu item data object.
     539 * @param int      $depth Depth of menu item. Used for padding.
     540 * @return stdClass An object of wp_nav_menu() arguments.
    541541 */
    542542function twentytwenty_add_sub_toggles_to_main_menu( $args, $item, $depth ) {
     
    581581 * Displays SVG icons in social links menu.
    582582 *
    583  * @param  string  $item_output The menu item output.
    584  * @param  WP_Post $item        Menu item object.
    585  * @param  int     $depth       Depth of the menu.
    586  * @param  array   $args        wp_nav_menu() arguments.
    587  * @return string  $item_output The menu item output with social icon.
     583 * @param string   $item_output The menu item's starting HTML output.
     584 * @param WP_Post  $item        Menu item data object.
     585 * @param int      $depth       Depth of the menu. Used for padding.
     586 * @param stdClass $args        An object of wp_nav_menu() arguments.
     587 * @return string The menu item output with social icon.
    588588 */
    589589function twentytwenty_nav_menu_social_icons( $item_output, $item, $depth, $args ) {
Note: See TracChangeset for help on using the changeset viewer.