0
我创建了一个新的菜单,它显示完美,但问题是与选择,它发送给我的页面或帖子不存在,问题,我想,.....更改格式输出我不知道我该如何解决这个问题。WordPress的创建菜单
我的代码:
<?php
wp_create_nav_menu('Mobil Menu', array('slug' => 'theme_footer_mobil_menu'));
class Walker_Nav_Menu_Dropdown extends Walker_Nav_Menu
{
// don't output children opening tag (`<ul>`)
public function start_lvl(&$output, $depth){}
// don't output children closing tag
public function end_lvl(&$output, $depth){}
public function start_el(&$output, $item, $depth, $args){
// add spacing to the title based on the current depth
$item->title = str_repeat(" ", $depth * 4) . $item->title;
// call the prototype and replace the <li> tag
// from the generated markup...
parent::start_el(&$output, $item, $depth, $args);
$output = str_replace('<li', '<option', $output);
}
// replace closing </li> with the closing option tag
public function end_el(&$output, $item, $depth){
$output .= "</option>\n";
}
}
wp_nav_menu(array(
"menu"=>"Mobil Menu",
'theme_location' => 'primary',
'walker' => new Walker_Nav_Menu_Dropdown(),
'items_wrap' => '<select class="footer_menu_mobile" onChange="if(this.selectedIndex!=0) self.location=this.options[this.selectedIndex].value">%3$s</select>',
));
?>
完美展现菜单下拉,但真正的问题是,从选择菜单中的URL启动,该URL显示与空格,没有权利
Thank's问候 !