为什么我的 Primarylinks 菜单只为某些项目添加类?
我定义了 2 个菜单,我想设置它们的样式...... 当我继续之前制作的 drupal 时,有一个菜单为每个条目分配类(还没有发现它是如何做到这一点的), 它的输出是这样的:
<ul class="menu">
<li class="leaf first"><a title="" class="flores" href="/huerto-urbano/flores">Flores</a></li>
<li class="leaf"><a title="" class="plantas" href="/huerto-urbano/plantas">Plantas</a></li>
<li class="leaf last"><a title="" class="verduras" href="/huerto-urbano/verduras">Verduras</a></li>
</ul>
注意到 class="flores" 了吗? 现在我创建了另一个与此类似的菜单,但是 class="XXXX" 消失了..为什么?
<ul class="menu">
<li class="leaf first"><a title="" href="/ca/huerto-urbano/flores">Flors</a></li>
<li class="leaf"><a title="" href="/ca/huerto-urbano/plantas">Plantes</a></li>
<li class="leaf last"><a title="" href="/ca/huerto-urbano/verduras">Verdures</a></li>
</ul>
I have 2 menus defined, and I want to style them...
As I'm continuing a previous made drupal there is a menu that assigns classes to each entry (haven't discovered how it does that),
it's outputs something like this:
<ul class="menu">
<li class="leaf first"><a title="" class="flores" href="/huerto-urbano/flores">Flores</a></li>
<li class="leaf"><a title="" class="plantas" href="/huerto-urbano/plantas">Plantas</a></li>
<li class="leaf last"><a title="" class="verduras" href="/huerto-urbano/verduras">Verduras</a></li>
</ul>
notice the class="flores"?
now I've created another menu similar to that but the class="XXXX" disapeares..why?
<ul class="menu">
<li class="leaf first"><a title="" href="/ca/huerto-urbano/flores">Flors</a></li>
<li class="leaf"><a title="" href="/ca/huerto-urbano/plantas">Plantes</a></li>
<li class="leaf last"><a title="" href="/ca/huerto-urbano/verduras">Verdures</a></li>
</ul>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我首先在主题目录中的 template.php 中搜索主题菜单项功能。例如,如果主题名称是“plants”,则搜索函数plants_menu_item或plants_menu_item_link。添加类属性的逻辑可能就在那里。
I would start by searching the template.php located in the theme directory for themed menu item functions. If the theme name is 'plants', for example, then search for the functions plants_menu_item or plants_menu_item_link. The logic to add the class attribute may be in there.
第二个菜单适用于不同的语言。您应该做的是检查问题是否是由翻译模块引起的。多语言设置似乎是罪魁祸首。
The second menu is for a different language. What you should do is check if the problem is because of the translate module. Multilanguage set up looks to be the culprit.