This guidance will explain you how to add WordPress menu location to your theme. 有时你可能需要添加一个额外的导航菜单,其中包含重要的或经常使用的链接,以增加WordPress站点的可用性.
To create a new menu you need to edit your theme files. Before making changes to any of your core files, it's best to backup your entire site in case something goes wrong along the way.
在管理仪表板下添加一个新的菜单位置选项 Appearance > Menus you need to 'register a menu'. All it takes is adding a snippet of code to your 'functions.php' file located under /wp-content/themes/your_theme/ directory on the server.
Hey, you! Have you heard about our new subscription service ONE? If no, just keep reading what I’m telling you about! 我们的新订阅服务ONE可以给你一个极好的机会来节省你的钱,并得到更多的项目. 订阅费用仅为每月19美元,您可以从一个包中下载任何材料. 只要订阅一个,就可以获得无限数量的酷元素! Check out what WordPress 我们现在为您在订阅中选择最合适的主题. Moreover, if you are a blog reader, 使用简单的促销码,您可以获得5%的折扣 BecomeThe1.
Access your server using ftp client or FileManager provided by your host. Navigate to /wp-content/themes/your_theme/ directory on your server. Open the 'functions.php' file for editing.
Scroll to the bottom of the file. 如果您只想添加一个菜单,请在新行添加以下代码:
function register_my_menu() { register_nav_menu('additional-menu',__( 'Additional Menu' )); } add_action( 'init', 'register_my_menu' );
In this example, 'Additional Menu' 该名称是否会出现在管理仪表板的菜单页面中. The 'additional-menu' name is what WordPress will understand to execute your code properly.
如果您想在站点中添加多个菜单,请在新行中添加以下代码:
function register_my_menus() { register_nav_menus( array( 'additional-menu' => __( 'Additional Menu' ), 'another-menu' => __( 'Another Menu' ), 'extra-menu' => __( 'Extra Menu' ) ) ); } add_action( 'init', 'register_my_menus' );
You can add as many new menus as you'd like with this method. The same rules will apply when naming them. Save the changes you made to the file.
Head over to Appearance > Menus in your dashboard. 您会注意到您的新菜单将被列在主题位置 Manage Location section.
Feel free to create a new menu or use an existing one. Once you have created a new menu, 您还可以在“管理位置”选项卡下管理显示的位置.
这是你需要决定把菜单放在哪里的地方. 如果您希望菜单显示在页面顶部,则需要编辑 'header.php' file. 你也可以把它放在页脚这意味着你可以编辑 'footer.php' file. 您甚至可以通过编辑其模板文件在页面上显示菜单,或者在侧边栏上编辑其 'sidebar.php' file.
You can place your new menu where ever you'd like. 以下是你需要添加到这些位置的最少代码量:
'additional-menu' ) ); ?>
Where additional-menu is your new menu.
你可能想用CSS来设计你的菜单样式,这样它就不仅仅是基本的功能,而且看起来也很棒. 要做到这一点,你需要创建一个类,并用下面的代码将它添加到你的主题中:
'additional-menu', 'container_class' => 'new_menu_class' ) ); ?>
Again, replace additional-menu with the menu name you chose. We created 'new_menu_class' 类作为示例,请随意在这里指定您自己的样式类. 不要忘记在样式中为新创建的类添加样式规则.CSS file which is located under /wp-content/themes/your_theme/ directory on the server.
This is it, 你的主题有了一个额外的菜单,现在你离最伟大的网站又近了一步. Stay tuned!
Stratum Elementor Addon is a collection of 20+ advanced Elementor widgets with a strong business orientation. 该插件增强了现有的element小部件集合的功能,为各种网站提供了额外的多用途元素-从个人作品集和博客到商业网站和大型电子商务项目.
尽管地层小部件与付费解决方案相当,即使是Elementor Pro插件用户也可以免费试用所有20多个插件. Moreover, 该插件提供了访问独家和高要求的选项不可用,甚至在元素Pro包.
Under Menu settings>Display location, 你还可以找到一个选项来决定你的菜单在你的WordPress网站上显示的位置. These settings may vary depending on a WordPress theme.
添加wordpress菜单位置或自定义您网站的默认菜单, you have to enter the WordPress dashboard, click on Appearance and then on Menus.
我们建议您使用elements页面构建器来拖放自定义您的WordPress主题或现成的网站. There is a growing number of themes, templates, 以及与element市场上提供的页面构建器兼容的插件.
你可以用插件给你的WordPress网站添加很多功能和工具. A WordPress plugin is essentially an add-on for your website. 插件通常会为你的WordPress网站添加新的特性或功能,而你几乎不需要付出任何努力. Just install and configure the plugin settings.
订阅我们的时事通讯和访问独家内容和提供只提供给og体育首页Post订户.
Leave a Reply
You must be logged in to post a comment.