我正在使用下面的walker创建一个下拉菜单,我将在我正在处理的项目的移动版本上使用它。。。它工作得很好,但是,当我选择页面时,它不会加载页面,我缺少了什么?
class Walker_Nav_Menu_Dropdown extends Walker_Nav_Menu{
function start_lvl(&$output, $depth){
$indent = str_repeat("\\t", $depth); // don\'t output children opening tag (`<ul>`)
}
function end_lvl(&$output, $depth){
$indent = str_repeat("\\t", $depth); // don\'t output children closing tag
}
function start_el(&$output, $item, $depth, $args){
// add spacing to the title based on the depth
$item->title = str_repeat(" ", $depth * 4).$item->title;
parent::start_el(&$output, $item, $depth, $args);
// no point redefining this method too, we just replace the li tag...
$output = str_replace(\'<li\', \'<option\', $output);
}
function end_el(&$output, $item, $depth){
$output .= "</option>\\n"; // replace closing </li> with the option tag
}
}
提前谢谢。