如何在WordPress管理栏中添加主题编辑器

In the past we have shown you how to add the shortlink menu, draft posts, and other things to the WordPress admin bar. In this article, we will show you how to add the Theme Editor in WordPress Admin Bar.

过去,我们向您展示了如何将短链接菜单草稿帖子其他内容添加到WordPress管理栏中。 在本文中,我们将向您展示如何在WordPress管理栏中添加主题编辑器。

All you need to do is either open your site-specific plugin or your theme’s functions.php file and paste the following code:

您需要做的就是打开您特定于站点的插件或主题的functions.php文件,然后粘贴以下代码:

// Add Theme Editor to Admin Bar (to save time!)
function admin_bar_theme_editor_option() {  
	global $wp_admin_bar;   
		if ( !is_super_admin() || !is_admin_bar_showing() )      
		return;    
		$wp_admin_bar->add_menu(        
			array( 'id' => 'edit-theme',            
			'title' => __('Edit Theme'),
                        'href' => admin_url( 'theme-editor.php')       
		)    
		);
	}

add_action( 'admin_bar_menu', 'admin_bar_theme_editor_option', 100 );

That is it. We found this code floating around on the WordCamp Nashville Hashtag. We tried it on WordPress 3.3.2 and it works. The code should work for other versions as well.

这就对了。 我们发现此代码在WordCamp Nashville Hashtag上浮动。 我们在WordPress 3.3.2上进行了尝试,并且可以正常工作。 该代码也应适用于其他版本。

翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-add-the-theme-editor-in-wordpress-admin-bar/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值