How to Add the Theme Editor in WordPress Admin Bar

232

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.

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

// 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.

Social Media Auto Publish Powered By : XYZScripts.com