如何向我的网站添加自定义菜单以及我需要编辑什么文件?

How can I add a custom menu to my website and what file would I need to edit?

我正在使用 wordpress,我正在使用一个名为

的插件

theme switcher

此插件允许我为移动设备使用不同的主题。也就是说,{theme switcher} 等其他插件 NOT 保存了我的内容。

Example.

  1. I activated the desktop theme I selected for my mobile site, so i could make changes in the wordpress dashboard.

  2. I edited the content (no custom code used) . I only used the wordpress appearance menu to edit this theme.

  3. When I was done , I switch my theme back to my orignal website for my Desktop

  4. All of the changes I made disappears off the mobile site, the color starts getting distorted, but when I switch my mane website back the changes comeback.

话虽这么说

我知道对文件进行永久编辑的唯一方法是直接在我的文件管理器中转到文件。

直接在我为我的移动网站选择的主题文件夹中。

如何将菜单列表添加到主题文件?

"menu include" 通常位于给定主题的 header.php 文件中。查找类似以下内容:

<?php wp_nav_menu( $args ); ?> 

如果您将此行替换为类似的内容,它将使您的菜单永久化,您将无法在 "Appearance > Menus" 中对其进行编辑:

<div id="menu">
    <ul>
        <li><a href="/">Home</a></li>
        <li><a href="/yes">Yes</a></li>
        <li><a href="/no">No</a></li>
    </ul>
</div>

公平警告,任何主题更新都将覆盖此 header.php 文件。如果您想保留这些更改,则必须查看 Child Themes.