![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
wordpress
赵蔚冬
这个作者很懒,什么都没留下…
展开
-
移除 WordPress 菜单输出的多余的CSS选择器id或class
现在大多数的WordPress主题都使用 wp_nav_menu() 来添加菜单,这个函数默认会输出很多CSS选择器,比如下面的代码:<li id="menu-item-6" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item...原创 2019-07-20 09:20:10 · 701 阅读 · 0 评论 -
apply_filters()(创建过滤器)和add_filter()(添加过滤器)
add_filter()(添加过滤器):apply_filters( string $tag, mixed $value )Call the functions added to a filter hook.调用函数DescriptionThe callback functions attached to filter hook $tag are invoked by calling t...原创 2019-07-12 19:58:20 · 5565 阅读 · 1 评论 -
WordPress wp_nav_menu的li标签添加自定义class类
function wpmaker_menu_classes($classes, $item, $args) { if($args->theme_location == 'mymenu') { //mymenu是菜单的id $classes[] = 'custom-class'; } return $classes;}add_filter('nav_menu_css_clas...原创 2019-07-12 17:53:02 · 2426 阅读 · 0 评论 -
WordPress菜单处理-一些特殊处理-草稿
将下面代码添加到function文件中,用以添加导航菜单中修改class的类名<?php function MBT_menu_classes($classes, $item,$depth) { if(0 == $depth) { $classes[] = 'nav-item'; } if(1 == $depth) { $classes[] = 'nav-i...原创 2019-07-12 17:32:29 · 320 阅读 · 0 评论