Make WordPress Core

Changeset 55963


Ignore:
Timestamp:
06/21/2023 11:49:14 AM (15 months ago)
Author:
audrasjb
Message:

Twenty Nineteen: Remove unused function parameters and variables.

This changeset removes unused parameters and variables, fixes a typo, and improves some docblocks as per documentation standards.

Props upadalavipul, mukesh27, costdev, sabernhardt, hellofromtonya, audrasjb.
Fixes #57397.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentynineteen/inc/template-functions.php

    r53236 r55963  
    11<?php
    22/**
    3  * Functions which enhance the theme by hooking into WordPress
     3 * Functions which enhance the theme by hooking into WordPress.
    44 *
    55 * @package WordPress
     
    3535/**
    3636 * Adds custom class to the array of posts classes.
    37  */
    38 function twentynineteen_post_classes( $classes, $css_class, $post_id ) {
     37 *
     38 * @param array $classes A list of existing post class values.
     39 * @return array The filtered post class list.
     40 */
     41function twentynineteen_post_classes( $classes ) {
    3942    $classes[] = 'entry';
    4043
    4144    return $classes;
    4245}
    43 add_filter( 'post_class', 'twentynineteen_post_classes', 10, 3 );
    44 
    45 
    46 /**
    47  * Add a pingback url auto-discovery header for single posts, pages, or attachments.
     46add_filter( 'post_class', 'twentynineteen_post_classes' );
     47
     48/**
     49 * Adds a pingback url auto-discovery header for single posts, pages, or attachments.
    4850 */
    4951function twentynineteen_pingback_header() {
     
    9799
    98100/**
    99  * Add custom 'sizes' attribute to responsive image functionality for post thumbnails.
     101 * Adds custom 'sizes' attribute to responsive image functionality for post thumbnails.
    100102 *
    101103 * @origin Twenty Nineteen 1.0
     
    117119    return $attr;
    118120}
    119 add_filter( 'wp_get_attachment_image_attributes', 'twentynineteen_post_thumbnail_sizes_attr', 10, 1 );
    120 
    121 /**
    122  * Add an extra menu to our nav for our priority+ navigation to use
    123  *
    124  * @param string $nav_menu  Nav menu.
    125  * @param object $args      Nav menu args.
     121add_filter( 'wp_get_attachment_image_attributes', 'twentynineteen_post_thumbnail_sizes_attr' );
     122
     123/**
     124 * Adds an extra menu to our nav for our priority+ navigation to use.
     125 *
     126 * @param string $nav_menu Nav menu.
     127 * @param object $args     Nav menu args.
    126128 * @return string More link for hidden menu items.
    127129 */
     
    157159
    158160/**
    159  * WCAG 2.0 Attributes for Dropdown Menus
    160  *
    161  * Adjustments to menu attributes tot support WCAG 2.0 recommendations
     161 * Handles WCAG 2.0 attributes for dropdown menus.
     162 *
     163 * Adjustments to menu attributes to support WCAG 2.0 recommendations
    162164 * for flyout and dropdown menus.
    163165 *
    164166 * @ref https://www.w3.org/WAI/tutorials/menus/flyout/
    165  */
    166 function twentynineteen_nav_menu_link_attributes( $atts, $item, $args, $depth ) {
     167 * @param array   $atts {
     168 *     The HTML attributes applied to the menu item's `<a>` element, empty strings are ignored.
     169 *
     170 *     @type string $title        Title attribute.
     171 *     @type string $target       Target attribute.
     172 *     @type string $rel          The rel attribute.
     173 *     @type string $href         The href attribute.
     174 *     @type string $aria-current The aria-current attribute.
     175 * }
     176 * @param WP_Post $item The current menu item object.
     177 * @return string[] Modified attributes.
     178 */
     179function twentynineteen_nav_menu_link_attributes( $atts, $item ) {
    167180
    168181    // Add [aria-haspopup] and [aria-expanded] to menu items that have children.
     
    175188    return $atts;
    176189}
    177 add_filter( 'nav_menu_link_attributes', 'twentynineteen_nav_menu_link_attributes', 10, 4 );
    178 
    179 /**
    180  * Create a nav menu item to be displayed on mobile to navigate from submenu back to the parent.
     190add_filter( 'nav_menu_link_attributes', 'twentynineteen_nav_menu_link_attributes', 10, 2 );
     191
     192/**
     193 * Creates a nav menu item to be displayed on mobile to navigate from submenu back to the parent.
    181194 *
    182195 * This duplicates each parent nav menu item and makes it the first child of itself.
Note: See TracChangeset for help on using the changeset viewer.