Wordpress Brandings entfernen

Wordpress Brandings entfernen

WordPress ist ein großartiges Tool für kleine Homepages und professionelle Websites. Noch dazu ist es kostenlos und quelloffen. Aber es gibt weitaus mehr Einsatzmöglichkeiten. Zum Beispiel als kleines Intranet-Wiki oder für den Digital Signage Bereich.

Manchmal ist es dann notwendig alle WordPress-Brandings inklusive Logos und Links von der Login-Seite und aus dem Backend zu entfernen um ein Whitelabel zu schaffen. Folgendes Script, welches man entweder im Theme oder in einem eigenen Plugin unterbringen kann, erledigt das:

<?PHP
 
/*
	Configure login
*/
define('SIGNPRESS_CHANGE_LOGIN_LOGO_PATH',true);
define('SIGNPRESS_LOGIN_LOGO_PATH','/wp-content/your_logo.png');
define('SIGNPRESS_LOGIN_LOGO_WIDTH',300);
define('SIGNPRESS_LOGIN_LOGO_HEIGHT',150);
define('SIGNPRESS_CHANGE_LOGIN_LOGO_TITLE',true);
define('SIGNPRESS_LOGIN_LOGO_TITLE','My Logo Title');
define('SIGNPRESS_CHANGE_LOGIN_LOGO_LINK',true);
define('SIGNPRESS_LOGIN_LOGO_LINK','http://www.mypage.com/');
 
/*
	Configure admin
*/
define('SIGNPRESS_REMOVE_WP_FROM_ADMIN_BAR',true);
define('SIGNPRESS_REMOVE_WP_ADMIN_WIDGETS',true);
define('SIGNPRESS_REMOVE_WP_WELCOME_PANEL',true);
define('SIGNPRESS_REMOVE_WP_ADMIN_HELP_TAB',true);
 
/*
	Clear, change and remove the WordPress soul :-(
*/
 
// Change login logo
if(SIGNPRESS_CHANGE_LOGIN_LOGO_PATH){
	add_action('login_enqueue_scripts', function () {
		$html = '';
		$html.= '<style type="text/css">';
			$html.= 'body.login div#login h1 a {';
				$html.= 'background-image: url('.SIGNPRESS_LOGIN_LOGO_PATH.');';
				$html.= 'background-size: '.SIGNPRESS_LOGIN_LOGO_WIDTH.'px auto;';
				$html.= 'width:'.SIGNPRESS_LOGIN_LOGO_WIDTH.'px;';
				$html.= 'height:'.SIGNPRESS_LOGIN_LOGO_HEIGHT.'px;';
			$html.= '}';
		$html.= ' </style>';
		echo $html;
	});
}
 
 
// Change login logo link
if(SIGNPRESS_CHANGE_LOGIN_LOGO_LINK){
	add_filter( 'login_headerurl', function () {
		return SIGNPRESS_LOGIN_LOGO_LINK;
	} );
}
 
 
// Change login logo title
if(SIGNPRESS_CHANGE_LOGIN_LOGO_TITLE){
	add_filter( 'login_headertitle', function () {
		return SIGNPRESS_LOGIN_LOGO_TITLE;
	} );
}
 
 
// Remove WordPress logo from admin bar
if(SIGNPRESS_REMOVE_WP_FROM_ADMIN_BAR){
	add_action('wp_before_admin_bar_render', function () {
		global $wp_admin_bar;
		$wp_admin_bar->remove_menu('wp-logo');
	}, 0);
}
 
 
// Remove WordPress news widgets from backend
if(SIGNPRESS_REMOVE_WP_ADMIN_WIDGETS){
	add_action( 'admin_init', function () {
		remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal' );
		remove_meta_box('dashboard_plugins', 'dashboard', 'normal' );
		remove_meta_box('dashboard_primary', 'dashboard', 'normal' );
		remove_meta_box('dashboard_secondary', 'dashboard', 'normal' );
		remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal' );
		remove_meta_box('dashboard_quick_press', 'dashboard', 'side' );
		remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side' );
		remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal' );
		remove_meta_box('dashboard_right_now', 'dashboard', 'normal' );
		remove_meta_box('dashboard_activity', 'dashboard', 'normal' );
	} );
}
 
 
// Remove WordPress welcome panel
if(SIGNPRESS_REMOVE_WP_WELCOME_PANEL){
	remove_action('welcome_panel', 'wp_welcome_panel');
}
 
 
// Remove admin help tab
if(SIGNPRESS_REMOVE_WP_ADMIN_HELP_TAB){
	add_filter( 'contextual_help', function ($old_help, $screen_id, $screen){
		$screen->remove_help_tabs();
		return $old_help;
	}, 999, 3 );
}
 

Du suchst einen Wordpress-Entwickler?
So findest du mich!