问题标签 [wp-nav-walker]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
javascript - 将 if/else 窗口宽度子句添加到 Wordpress navwalker.php
此处的目标是使具有子项的 Wordpress boostrap 主菜单顶级项充当设备 > 768 px 宽的可点击链接,并保留小型设备的默认行为。
在 navwalker.php 文件的第 83 行附近有以下代码:
为了使链接在普通屏幕上可点击,我需要修改代码,然后添加一个 else 语句,以便它保留默认行为,例如:
问题是如何获取 $windowwidth,大概是在 JavaScript 中,以便我可以在 PHP if/else 子句中使用它。
wordpress - 如何添加属性对于特定的菜单项
我正在使用菜单描述为具有以下功能的菜单项添加图像
然而 HTML 标记是这样的
我想在<li>该特定菜单项的内部添加图像(无论是背景图像还是其他)。像这样的东西
任何帮助将不胜感激。谢谢
wordpress - 将图像添加到 wp 导航菜单,以及菜单链接文本
如何将图像添加到 wp-nav 菜单,我想并排显示图像和链接文本。请帮助。
html - Two-part Bootstrap navigation menu with logo in the center
I am making a dynamic wordpress links in navigation bar using nav_walker. How can i implement center something like this in wordpress nav_walker:
How can i do that or something provide me jsfiddle to come up with that please. Is it two nav_walker function for left and right navigation? how can i insert the navbar brand in center? can anyone give me structure. thanks.
my code:
php - WordPress 菜单助行器项目具有“错误”字段
我正在尝试为 WordPress 主题(基于 _s)创建(我的第一个)菜单步行器,但我无法将工作菜单作为输出。我在网上找到了几个例子,但似乎没有一个能正常工作。$item 变量看起来很奇怪。如果我做一个
我从转储中得到一个 WP-Post 输出,没有 $item->url、没有 $item->title 等。我确实有一个 $item->guid、$item->post_title。我通过以下方式调用 header.php 中的 walker:
我想我正在做一些非常愚蠢的事情,但现在我看不到是什么。
wordpress - Wordpress walker is working, but not correctly
Last year I managed to add additional elements into my Wordpress menu by using a walker. (How can I add parent menu description to my Wordpress menu?)
Currently, the walker look slike this in my functions file:
Essentially, what I wanted to do was to add an image and a short description to each first level sub menu on the website: www.bellavou.co.uk
If you visit this site, you'll see it looks fine, because I've used CSS to hide all the other instances I don't want shown. But if you inspect, you'll see that a menu-image container is added for every submenu within the parent menu items.
i.e. Inside 'Face', there is a menu-item div within the 'Face', 'Eye' and 'Ear' submenu, as well as the one that's showing inside the main sub-menu.
I only want the main one to show, and I Think this is achieved by changing the depth settings, but I've tried and it's not making any changes.
What can I do to only create the new sub-menu once within the top level parent sub-menu?
UPDATE & SOLVED:
Turns out I was thinking along the right lines, in terms of depth where the rules get applied. But didn't think about the existing sub menus I have.
This has now fixed it with only the image div appearing once at the very top of the parent sub-menu, and the others just displaying their child items.
menuitem - 在 Wordpress 主题 wp nav 中使用 Boostrap
谁能告诉我如何将 Bootstrap 集成到我的导航菜单的 Wordpress 主题中?我只想要一个简单易懂的解释,因为我是初学者。
css - 选择子项时将类添加到父项 Walker Nav Menu
您好,我有以下 Walker Nav 菜单。
}
我要实现的目标是选择子菜单将活动类添加到顶级LI。这可以通过walker nav菜单还是通过css实现?我看到了几个使用 jquery 的解决方案,但我更喜欢使用 css 或 Walker Nav 菜单作为解决方案。
php - 使用 Walker 类编辑 WordPress 菜单时出错
我目前正在关注有关如何编辑 WordPress 菜单的 YouTube 教程。本教程建议在“walker.php”文件中包含以下代码:
当我包含此代码时,我的网站会返回一个“HTTP ERROR 500”页面。通过注释掉代码的每一行,以一种消除方式,我将有问题的代码隔离为:
我在这里检查了其他类似标题的问题,但无法弄清楚问题可能是什么。有没有人能看到我在这个特定代码上哪里出错了?
我不确定 HTML 标记是否在错误中起作用,但以防万一,这里是所述标记的代码:
wordpress - Wordpress 自定义 Walker 菜单
一整天我都在努力创建一个自定义菜单walker,它将适合必须在前端的标记。
这是所需的标记:
我有一些扩展Walker_Nav_Menu的自定义类示例, 但我认为这些示例不好。
这是我到目前为止所拥有的:http: //pastebin.com/qnPx9J67
重要的!我想在我的课程中使用 BEM 方法,例如:
我还想保留一些默认的 Wordpress 类,但格式如下: 示例:
我希望有人可以帮助我解决这个问题,因为我不太了解 PHP。:)
来源链接:https ://developer.wordpress.org/reference/classes/walker_nav_menu/