Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Filter 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.
- * }
- * @param object $item The current menu item.
- * @param array $args An array of {@see wp_nav_menu()} arguments.
- * @param int $depth Depth of menu item. Used for padding.
- */
- $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth );
- $attributes = '';
- foreach ( $atts as $attr => $value ) {
- if ( ! empty( $value ) ) {
- $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
- $attributes .= ' ' . $attr . '="' . $value . '"';
- }
- }
- /** This filter is documented in wp-includes/post-template.php */
- $title = apply_filters( 'the_title', $item->title, $item->ID );
- /**
- * Filter a menu item's title.
- *
- * @since 4.4.0
- *
- * @param string $title The menu item's title.
- * @param object $item The current menu item.
- * @param array $args An array of {@see wp_nav_menu()} arguments.
- * @param int $depth Depth of menu item. Used for padding.
- */
- $title = apply_filters( 'nav_menu_item_title', $title, $item, $args, $depth );
- $item_output = $args->before;
- $item_output .= '<a'. $attributes .'>';
- $item_output .= $args->link_before . $title . $args->link_after;
- $item_output .= '</a>';
- $item_output .= $args->after;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement