- //向菜单中添加分类自定义值
- function be_header_menu_desc( $item_output, $item, $depth, $args ) {
- if( 'header-menu' == $args->theme_location && get_option('thumb-'.$item->object_id) )
- $item_output = str_replace( $args->link_before . '</a>', '<img src="'.get_option('thumb-'.$item->object_id).'" alt="'.$item->title.'">'.$args->link_before.'</a>', $item_output );
- return $item_output;
- }
- add_filter( 'walker_nav_menu_start_el', 'be_header_menu_desc', 10, 4 );
WordPress向菜单中添加分类缩略图
标签:
如需转载,请注明出处:https://salongweb.com/wordpress-menu-category-thumb.html
加载中…
WordPress 从不需要的页面禁用 WooCommerce 样式和脚本
WordPress 功能函数—— add_clean_index(向指定的表添加索引)
WordPress+Nuxt.js+Vue.js开发的前端node项目被停止的处理方案
WordPress 判断是否在循环中的函数 in_the_loop
WordPress 功能函数—— activate_plugin(已激活的插件不会再次尝试激活)
CSS3 background-attachment:fixed实现滚动视差效果
WordPress 限制上传媒体的文件类型
WordPress 重置缩略图插件 Regenerate Thumbnails 获取媒体数量时错误的解决方法
WordPress 最简便的边栏调用方法与提示
WordPress 如何根据文章类型向编辑器添加 CSS
WordPress按角色获取可分页的用户列表并显示最新文章
WordPress网站维护状态插件maintenance mode
加载中…