Twenty Twenty: Remove various unused function parameters and variables.

This removes the `$n` variable from `TwentyTwenty_Walker_Page` class `start_el()` function, removes an unused global and the last parameter from 
`twentytwenty_filter_wp_list_pages_item_classes()` and `twentytwenty_add_sub_toggles_to_main_menu()`.

Props upadalavipul, sabernhardt, mukesh27.
Fixes #57371.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2023-06-26 21:33:23 +00:00
parent 6adb9be81f
commit 1d66cc61ef
3 changed files with 5 additions and 12 deletions

View File

@ -38,10 +38,8 @@ if ( ! class_exists( 'TwentyTwenty_Walker_Page' ) ) {
if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) { if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) {
$t = "\t"; $t = "\t";
$n = "\n";
} else { } else {
$t = ''; $t = '';
$n = '';
} }
if ( $depth ) { if ( $depth ) {
$indent = str_repeat( $t, $depth ); $indent = str_repeat( $t, $depth );

View File

@ -241,8 +241,6 @@ add_filter( 'edit_post_link', 'twentytwenty_edit_post_link', 10, 3 );
* *
* @since Twenty Twenty 1.0 * @since Twenty Twenty 1.0
* *
* @global WP_Post $post Global post object.
*
* @param int $post_id The ID of the post. * @param int $post_id The ID of the post.
* @param string $location The location where the meta is shown. * @param string $location The location where the meta is shown.
*/ */
@ -331,7 +329,6 @@ function twentytwenty_get_post_meta( $post_id = null, $location = 'single-top' )
// Make sure we don't output an empty container. // Make sure we don't output an empty container.
$has_meta = false; $has_meta = false;
global $post;
$the_post = get_post( $post_id ); $the_post = get_post( $post_id );
setup_postdata( $the_post ); setup_postdata( $the_post );
@ -545,10 +542,9 @@ function twentytwenty_get_post_meta( $post_id = null, $location = 'single-top' )
* @param WP_Post $page Page data object. * @param WP_Post $page Page data object.
* @param int $depth Depth of page, used for padding. * @param int $depth Depth of page, used for padding.
* @param array $args An array of arguments. * @param array $args An array of arguments.
* @param int $current_page ID of the current page.
* @return array CSS class names. * @return array CSS class names.
*/ */
function twentytwenty_filter_wp_list_pages_item_classes( $css_class, $page, $depth, $args, $current_page ) { function twentytwenty_filter_wp_list_pages_item_classes( $css_class, $page, $depth, $args ) {
// Only apply to wp_list_pages() calls with match_menu_classes set to true. // Only apply to wp_list_pages() calls with match_menu_classes set to true.
$match_menu_classes = isset( $args['match_menu_classes'] ); $match_menu_classes = isset( $args['match_menu_classes'] );
@ -571,7 +567,7 @@ function twentytwenty_filter_wp_list_pages_item_classes( $css_class, $page, $dep
} }
add_filter( 'page_css_class', 'twentytwenty_filter_wp_list_pages_item_classes', 10, 5 ); add_filter( 'page_css_class', 'twentytwenty_filter_wp_list_pages_item_classes', 10, 4 );
/** /**
* Adds a Sub Nav Toggle to the Expanded Menu and Mobile Menu. * Adds a Sub Nav Toggle to the Expanded Menu and Mobile Menu.
@ -580,10 +576,9 @@ add_filter( 'page_css_class', 'twentytwenty_filter_wp_list_pages_item_classes',
* *
* @param stdClass $args An object of wp_nav_menu() arguments. * @param stdClass $args An object of wp_nav_menu() arguments.
* @param WP_Post $item Menu item data object. * @param WP_Post $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @return stdClass An object of wp_nav_menu() arguments. * @return stdClass An object of wp_nav_menu() arguments.
*/ */
function twentytwenty_add_sub_toggles_to_main_menu( $args, $item, $depth ) { function twentytwenty_add_sub_toggles_to_main_menu( $args, $item ) {
// Add sub menu toggles to the Expanded Menu with toggles. // Add sub menu toggles to the Expanded Menu with toggles.
if ( isset( $args->show_toggles ) && $args->show_toggles ) { if ( isset( $args->show_toggles ) && $args->show_toggles ) {
@ -622,7 +617,7 @@ function twentytwenty_add_sub_toggles_to_main_menu( $args, $item, $depth ) {
} }
add_filter( 'nav_menu_item_args', 'twentytwenty_add_sub_toggles_to_main_menu', 10, 3 ); add_filter( 'nav_menu_item_args', 'twentytwenty_add_sub_toggles_to_main_menu', 10, 2 );
/** /**
* Displays SVG icons in social links menu. * Displays SVG icons in social links menu.

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.3-alpha-56044'; $wp_version = '6.3-alpha-56045';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.