跳至内容
Python 俱乐部
用户工具
登录
站点工具
搜索
工具
显示页面
修订记录
反向链接
最近更改
媒体管理器
网站地图
登录
>
最近更改
媒体管理器
网站地图
您的足迹:
wordpress:remove-admin-bar-links
本页面只读。您可以查看源文件,但不能更改它。如果您觉得这是系统错误,请联系管理员。
====== Add/Remove Admin Bar Links ====== The WP Admin Bar is new in 3.1. Here is a basic function and hook you can use in your theme’s functions.php file to Add a new link to the WP Admin Bar, and Remove an existing link. Here are some IDs for the default links WP 3.1 adds, found in /wp-includes/admin-bar.php: <code? my-account / my-account-with-avatar : the first link, to your account. Note that the ID here changes depending on if you have Avatars enabled or not. my-blogs : the ‘My Sites’ menu if the user has more than one site get-shortlink : provides a Shortlink to that page edit : link to Edit [content-type] new-content : the ‘Add New’ dropdown comments : the ‘Comments’ dropdown appearance : the ‘Appearance’ dropdown updates : the ‘Updates’ dropdown </code> Code Example: <?php function mytheme_admin_bar_render() { global $wp_admin_bar; // we can remove a menu item, like the Comments link, just by knowing the right $id $wp_admin_bar->remove_menu('comments'); // or we can remove a submenu, like New Link. $wp_admin_bar->remove_menu('new-link', 'new-content'); // we can add a submenu item too $wp_admin_bar->add_menu( array( 'parent' => 'new-content', 'id' => 'new_media', 'title' => __('Media'), 'href' => admin_url( 'media-new.php') ) ); } // and we hook our function via add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' ); ?>
wordpress/remove-admin-bar-links.1516351280.txt.gz
· 最后更改: 2018/01/19 08:41 由
admin
页面工具
显示页面
修订记录
反向链接
回到顶部