-
Notifications
You must be signed in to change notification settings - Fork 0
/
wp-footer-walker.php
59 lines (51 loc) · 1.95 KB
/
wp-footer-walker.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php if (!class_exists('Footer_Menu_Walker')) {
/**
* Menu Walker that traverses the footer menu, laying out the first level as
* columns and any subsequent levels as rows.
*
* @extends Walker_Nav_Menu
*/
class Footer_Menu_Walker extends Walker_Nav_Menu {
function start_lvl(&$output, $depth = 0, $args = array()) {
$indent = str_repeat("\t", $depth);
if ($depth > 0) {
$output .= "\n$indent<ul class=\"footer-menu depth_$depth\">\n";
}
}
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
if ($depth == 0) {
$output .= "\n<div class=\"col-md\">\n";
}
$indent = $depth ? str_repeat("\t", $depth) : '';
$output .= $indent;
$attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr($item->attr_title) . '"' : '';
$attributes .= ! empty( $item->target ) ? ' target="' . esc_attr($item->target) . '"' : '';
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr($item->xfn) . '"' : '';
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr($item->url) . '"' : '';
//$item_output = $args->before;
if ($depth == 0) {
$item_output .= '<h3>';
} else {
$item_output .= '<a' . $attributes . '>';
}
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
if ($depth == 0) {
$item_output .= '</h3>';
} else {
$item_output .= '</a>';
}
//$item_output .= $args->after;
$output .= ($depth > 0) ? '<li>' : '';
$output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
$output .= ($depth > 0) ? '</li>' : '';
}
function end_lvl(&$output, $depth = 0, $args = array()) {
$indent = str_repeat("\t", $depth);
if ($depth > 0) {
$output .= "\n$indent</ul>\n";
} else {
$output .= "\n$indent</div>\n";
}
}
}
}