WordPress实现这种响应菜单设置的最佳方法是什么?

我在左边有一个菜单,中间是一个徽标,右边是另一个菜单,我的想法是在左边显示一个汉堡按钮,其中包含了移动/平板电脑大小的两个菜单。有内置的功能吗?或者我应该使用一个插件或其他方式?另外,因为我使用引导4,我正在考虑是否使用导航沃克。必须具备的条件是能够通过WordPress的内置功能修改菜单,以便客户端可以修改它。 - 此主题是6个月前由snippet24修改的。 嗨,感谢您的帖子!很抱歉,您在设置响应菜单时遇到问题。有3种方法可以定制响应式菜单: - 手动–此方法要求您手动添加自定义CSS,适合中间用户。 - - CSS Hero–一个高级WordPress插件,允许您设计自己的WordPress主题,而无需编写一行代码(不需要HTML或CSS)。 - WordPress内置–WordPress使添加菜单和子菜单变得非常容易。 - 这个回复是noobe1kenobe在6个月前修改的。 嗨,我意识到我应该解释得更好: WordPress内置–WordPress使添加菜单和子菜单变得非常容易。 是的当然是这个。 但是我应该如何设置小型设备的菜单按钮,以及在中间有徽标,两边都有菜单的布局的最佳方法是什么。我知道我可以用css隐藏这些菜单,然后显示mobile的按钮,但是也许有更好的方法……WP内置菜单方案实际上只输出嵌套的ul/li结构。它的主题来决定如何在不同的屏幕宽度显示。我建议你找到一个你想要的主题,并用它们来指导你自己的工作。 在我看来,我会避免使用分割菜单,居中的logo方案。考虑到用户可以随意更改菜单内容,要让它看起来平衡几乎是不可能的。最好将徽标置于菜单行上方的中心,这样菜单本身就可以独立居中。如果logo必须分割菜单,可以提供两个菜单区域,让用户决定哪些项目放在哪一边。对于手机来说,这两个菜单可以叠放在一起,这样就可以显示为一个菜单。 谢谢!!我建议找到一个你想要的主题,并用它们作为你自己努力的指导。 。考虑到用户可以随意更改菜单内容,要使其看起来平衡几乎是不可能的。 也许我可以用最大可用空间/相同宽度设置两个div,这样它们就平衡了,使用flex start和end来表示左和右。 对于手机,这两个菜单可以堆叠在一起,因此它们显示为一个菜单。 发现了这个问题https://wordpress.stackexchange.com/a/299921 但我不完全理解它,尤其是如何使用wpu getu navu menu items() 我意识到没有必要堆叠它们往那边走。只需将菜单项添加到多个位置 - 此答复是6个月前由snippet24修改的。 问题:如何为左右菜单设置此结构?(这是引导结构)。我知道我可以使用navwalker,我可以直接在函数.php例如? The nav_menu function has a number of filters you can use to alter default menu item handling, so a functions.php solution should be feasible. Using a custom nav walker is probably the best solution. You can impose your walker on the menu through the \"wp_nav_menu_args\" filter, assigning to the \"walker\" arg an instance of your walker class. The only other approach I see is parsing the output string to count how many top level li elements there are, then inserting or similar at the proper spot in the string. You can use the \"wp_nav_menu\" filter for that. String manipulation like this is inherently weak and why I think the nav walker approach is best. Either way, of course you can balance left or right menu containers. My concern is balancing the menu item text itself. You can split an even number of items into left and right, but the text length of the items might be wildly different. And what if there is an odd number of items? Split the menu before or after the middle item? I suppose code could add up the characters that comprise the items and make the split as close as possible to the middle of the character count. Still will be unlikely to balance, but maybe it\"s close enough. Thank you so much!! Implemented with Nav walker so far so good. Still will be unlikely to balance, but maybe it\"s close enough. I think so I have one issue: more than one menu can\"t have the same location… Perhaps that could be a future feature request? - This reply was modified 6 months, 1 week ago by snippet24. Well, abstractly, more than one menu in a location could be seen as illogical, but I think I understand your dilemma. I think somehow the center logo HTML needs to be worked into the menu HTML, so that calling wp_nav_menu()输出两半以及徽标。 我之前说过,通过在中间插入关闭/打开ul标签来拆分菜单。另一种可能是在中间插入一个额外的菜单项,其中包含徽标html。 再次感谢,我解决了这个问题:删除了移动按钮的两个菜单中的ul标记,只返回左菜单和右菜单中的li元素,同时将它们插入硬编码的ul标记中。如果对某人有帮助,这是只返回> 源代码的附加代码:https://cerkit.com/2016/01/02/merging-two-menus-in-a-custom-wordpress-theme/

admin_action_{$_REQUEST[‘action’]}

do_action( "admin_action_{$_REQUEST[‘action’]}" )动作钩子::在发送“Action”请求变量时激发。Action Hook: Fires when an ‘action’ request variable is sent.目录锚点:#说明#源码说明(Description)钩子名称的动态部分$_REQUEST['action']引用从GET或POST请求派生的操作。源码(Source)更新版本源码位置使用被使用2.6.0 wp-admin/admin.php:...

日期:2020-09-02 17:44:16 浏览:1167

admin_footer-{$GLOBALS[‘hook_suffix’]}

do_action( "admin_footer-{$GLOBALS[‘hook_suffix’]}", string $hook_suffix )操作挂钩:在默认页脚脚本之后打印脚本或数据。Action Hook: Print scripts or data after the default footer scripts.目录锚点:#说明#参数#源码说明(Description)钩子名的动态部分,$GLOBALS['hook_suffix']引用当前页的全局钩子后缀。参数(Parameters)参数类...

日期:2020-09-02 17:44:20 浏览:1068

customize_save_{$this->id_data[‘base’]}

do_action( "customize_save_{$this->id_data[‘base’]}", WP_Customize_Setting $this )动作钩子::在调用WP_Customize_Setting::save()方法时激发。Action Hook: Fires when the WP_Customize_Setting::save() method is called.目录锚点:#说明#参数#源码说明(Description)钩子名称的动态部分,$this->id_data...

日期:2020-08-15 15:47:24 浏览:804

customize_value_{$this->id_data[‘base’]}

apply_filters( "customize_value_{$this->id_data[‘base’]}", mixed $default )过滤器::过滤未作为主题模式或选项处理的自定义设置值。Filter Hook: Filter a Customize setting value not handled as a theme_mod or option.目录锚点:#说明#参数#源码说明(Description)钩子名称的动态部分,$this->id_date['base'],指的是设置...

日期:2020-08-15 15:47:24 浏览:897

get_comment_author_url

过滤钩子:过滤评论作者的URL。Filter Hook: Filters the comment author’s URL.目录锚点:#源码源码(Source)更新版本源码位置使用被使用 wp-includes/comment-template.php:32610...

日期:2020-08-10 23:06:14 浏览:929

network_admin_edit_{$_GET[‘action’]}

do_action( "network_admin_edit_{$_GET[‘action’]}" )操作挂钩:启动请求的处理程序操作。Action Hook: Fires the requested handler action.目录锚点:#说明#源码说明(Description)钩子名称的动态部分$u GET['action']引用请求的操作的名称。源码(Source)更新版本源码位置使用被使用3.1.0 wp-admin/network/edit.php:3600...

日期:2020-08-02 09:56:09 浏览:875

network_sites_updated_message_{$_GET[‘updated’]}

apply_filters( "network_sites_updated_message_{$_GET[‘updated’]}", string $msg )筛选器挂钩:在网络管理中筛选特定的非默认站点更新消息。Filter Hook: Filters a specific, non-default site-updated message in the Network admin.目录锚点:#说明#参数#源码说明(Description)钩子名称的动态部分$_GET['updated']引用了非默认的...

日期:2020-08-02 09:56:03 浏览:862

pre_wp_is_site_initialized

过滤器::过滤在访问数据库之前是否初始化站点的检查。Filter Hook: Filters the check for whether a site is initialized before the database is accessed.目录锚点:#源码源码(Source)更新版本源码位置使用被使用 wp-includes/ms-site.php:93910...

日期:2020-07-29 10:15:38 浏览:831

WordPress 的SEO 教学:如何在网站中加入关键字(Meta Keywords)与Meta 描述(Meta Description)?

你想在WordPress 中添加关键字和meta 描述吗?关键字和meta 描述使你能够提高网站的SEO。在本文中,我们将向你展示如何在WordPress 中正确添加关键字和meta 描述。为什么要在WordPress 中添加关键字和Meta 描述?关键字和说明让搜寻引擎更了解您的帖子和页面的内容。关键词是人们寻找您发布的内容时,可能会搜索的重要词语或片语。而Meta Description则是对你的页面和文章的简要描述。如果你想要了解更多关于中继标签的资讯,可以参考Google的说明。Meta 关键字和描...

日期:2020-10-03 21:18:25 浏览:1713

谷歌的SEO是什么

SEO (Search Engine Optimization)中文是搜寻引擎最佳化,意思近于「关键字自然排序」、「网站排名优化」。简言之,SEO是以搜索引擎(如Google、Bing)为曝光媒体的行销手法。例如搜寻「wordpress教学」,会看到本站的「WordPress教学:12个课程…」排行Google第一:关键字:wordpress教学、wordpress课程…若搜寻「网站架设」,则会看到另一个网页排名第1:关键字:网站架设、架站…以上两个网页,每月从搜寻引擎导入自然流量,达2万4千:每月「有机搜...

日期:2020-10-30 17:23:57 浏览:1306