Changeset 55963
- Timestamp:
- 06/21/2023 11:49:14 AM (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentynineteen/inc/template-functions.php
r53236 r55963 1 1 <?php 2 2 /** 3 * Functions which enhance the theme by hooking into WordPress 3 * Functions which enhance the theme by hooking into WordPress. 4 4 * 5 5 * @package WordPress … … 35 35 /** 36 36 * 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 */ 41 function twentynineteen_post_classes( $classes ) { 39 42 $classes[] = 'entry'; 40 43 41 44 return $classes; 42 45 } 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. 46 add_filter( 'post_class', 'twentynineteen_post_classes' ); 47 48 /** 49 * Adds a pingback url auto-discovery header for single posts, pages, or attachments. 48 50 */ 49 51 function twentynineteen_pingback_header() { … … 97 99 98 100 /** 99 * Add custom 'sizes' attribute to responsive image functionality for post thumbnails.101 * Adds custom 'sizes' attribute to responsive image functionality for post thumbnails. 100 102 * 101 103 * @origin Twenty Nineteen 1.0 … … 117 119 return $attr; 118 120 } 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 use123 * 124 * @param string $nav_menu 125 * @param object $args 121 add_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. 126 128 * @return string More link for hidden menu items. 127 129 */ … … 157 159 158 160 /** 159 * WCAG 2.0 Attributes for Dropdown Menus160 * 161 * Adjustments to menu attributes to tsupport WCAG 2.0 recommendations161 * Handles WCAG 2.0 attributes for dropdown menus. 162 * 163 * Adjustments to menu attributes to support WCAG 2.0 recommendations 162 164 * for flyout and dropdown menus. 163 165 * 164 166 * @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 */ 179 function twentynineteen_nav_menu_link_attributes( $atts, $item ) { 167 180 168 181 // Add [aria-haspopup] and [aria-expanded] to menu items that have children. … … 175 188 return $atts; 176 189 } 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.190 add_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. 181 194 * 182 195 * 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.