SHOW:
|
|
- or go back to the newest paste.
1 | class custom_nav_walker extends Walker_Nav_Menu { | |
2 | function start_el(&$output, $item, $depth, $args) { | |
3 | global $wp_query; | |
4 | $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; | |
5 | ||
6 | $class_names = $value = ''; | |
7 | ||
8 | $classes = empty( $item->classes ) ? array() : (array) $item->classes; | |
9 | $classes[] = 'menu-item-' . $item->ID; | |
10 | ||
11 | $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) ); | |
12 | $class_names = ' class="' . esc_attr( $class_names ) . '"'; | |
13 | ||
14 | $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args ); | |
15 | $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : ''; | |
16 | ||
17 | - | $output .= $indent . '<h1' . $id . $value . $class_names .'>'; |
17 | + | $output .= $indent . '<l1' . $id . $value . $class_names .'>'; |
18 | ||
19 | $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; | |
20 | $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; | |
21 | $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; | |
22 | $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : ''; | |
23 | ||
24 | $item_output = $args->before; | |
25 | $item_output .= '<a'. $attributes .'>'; | |
26 | $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; | |
27 | $item_output .= '</a>'; | |
28 | $item_output .= $args->after; | |
29 | ||
30 | $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); | |
31 | } | |
32 | ||
33 | /** | |
34 | * @see Walker::end_el() | |
35 | * @since 3.0.0 | |
36 | * | |
37 | * @param string $output Passed by reference. Used to append additional content. | |
38 | * @param object $item Page data object. Not used. | |
39 | * @param int $depth Depth of page. Not Used. | |
40 | */ | |
41 | function end_el(&$output, $item, $depth) { | |
42 | - | $output .= "</h1>\n"; |
42 | + | $output .= "</li>\n"; |
43 | } | |
44 | } |