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問候 !