doujuanxun7167 2012-06-28 19:28
浏览 117
已采纳

Wordpress和current_menu_item

For some reason, menus within a widget in Wordpress do not get assigned classes such as the "current_menu_item" class - on top of that, when adding a class to the menu item in Worddpress > Appearance > Menu, they are not assigned the respective classes.

I want to be able to assign a current_page_item class, or any class for that matter, to highlight a currently active menu item within a widget. I'm not sure why classes are omitted from menus within a widget, but i guess it's an oversight from the developers or something.

Can anyone help me achieve the above?

Regards, Nick.

  • 写回答

1条回答 默认 最新

  • duanliaozhi2915 2012-06-28 20:35
    关注
    #access .current-menu-item > a,
    #access .current-menu-ancestor > a,
    #access .current_page_item > a,
    #access .current_page_ancestor > a {
        font-weight: bold;
    }
    

    This is where you're styling your .current-menu-item to be bold. However, your menu on the left is not inside the access nav element. The current-menu-item class is on your active menu item:

    <li id="menu-item-40" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item menu-item-40"><a href="/jason/bill-payment">Bill Payment</a></li>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料