我有一个Walker_Page我这样扩展的自定义类:
class List_Nav extends Walker_Page {
function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent<ul class='ListNav'>\n";
}
function start_el(&$output, $page, $depth = 0, $args = array(), $current_page = 0) {
$output .= '<li class="ListNav-item">';
$output .= '<a class="ListNav-link" href="' . get_permalink($page->ID) . '">' . apply_filters( 'the_title', $page->post_title, $page->ID ) . '</a>';
$output .= '</li>';
}
function end_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat("\t", …Run Code Online (Sandbox Code Playgroud)