2
A
回答
1
添加自定義鏈接菜單項(放在鏈接#值)
登錄到你的WordPress管理面板。導航到「外觀」,然後選擇菜單:
導航到左側的鏈接並輸入您想要用於此菜單按鈕的URL,添加鏈接文本以指定標籤將說的內容,然後單擊添加到菜單:
或者,如果你想控制你的菜單鏈接是否在點擊時會開啓新分頁,從屏幕選項中選中「鏈接目標」高級屬性,以揭示各個菜單項此設置:
刷新該網站,您將在導航菜單中看到新的自定義頁面和鏈接。
0
給菜單項鍊接一個值#
。
然後你需要一些Javascript來防止默認的鏈接點擊操作。
E.g.用jQuery:
$('.class').click(function(e){
e.preventDefault();
});
// replace class with whatever the selector of the link is. To cover ALL menu items that have sub menus (and have the WP classes), you can use '.menu-item-has-children a'
不錯!它效果很好。謝謝你的幫助! – dbardelas