![]() |
This code will allow you to easily modify the WordPress Login page Logo as well as the href link and title text of this logo. Tested on: WordPress 3.0.1 |
Example:
PHP
add_filter( 'login_headerurl', 'namespace_login_headerurl' );
/**
* Replaces the login header logo URL
*
* @param $url
*/
function namespace_login_headerurl( $url ) {
$url = home_url( '/' );
return $url;
}
add_filter( 'login_headertitle', 'namespace_login_headertitle' );
/**
* Replaces the login header logo title
*
* @param $title
*/
function namespace_login_headertitle( $title ) {
$title = get_bloginfo( 'name' );
return $title;
}
add_action( 'login_head', 'namespace_login_style' );
/**
* Replaces the login header logo
*/
function namespace_login_style() {
echo '<style>.login h1 a { background-image: url( ' . get_template_directory_uri() . '/images/logo.png ) !important; }</style>';
}
Example:
PHP
function namespace_login_style() {
if( function_exists('get_custom_header') ){
$width = get_custom_header()->width;
$height = get_custom_header()->height;
} else {
$width = HEADER_IMAGE_WIDTH;
$height = HEADER_IMAGE_HEIGHT;
}
echo '<style>'.PHP_EOL;
echo '.login h1 a {'.PHP_EOL;
echo ' background-image: url( '; header_image(); echo ' ) !important; '.PHP_EOL;
echo ' width: '.$width.'px !important;'.PHP_EOL;
echo ' height: '.$height.'px !important;'.PHP_EOL;
echo ' background-size: '.$width.'px '.$height.'px !important;'.PHP_EOL;
echo '}'.PHP_EOL;
echo '</style>'.PHP_EOL;
}
How to Enable Hidden Administration Feature displaying All Site Settings | Wordpress Administration Shortcode |
How to change the Login Logo & Image URL Link | Wordpress Administration Shortcode |
How to Remove Update Notification for all users except ADMIN User | Wordpress Administration Shortcode |
How to Remove Default WordPress Meta Boxes | Wordpress Administration Shortcode |
How to Remove "Wordpress" to "WordPress" filter | Wordpress Administration Shortcode |
How to Customize the order of the administration menu | Wordpress Administration Shortcode |
How to Add Thumbnails in Manage Posts/Pages List | Wordpress Administration Shortcode |
Full Code of change the Login Logo & Image URL Link | Wordpress Administration Shortcode |
Edit: Full Code of change the Login Logo & Image URL Link | Wordpress Administration Shortcode |
Read Full: | Wordpress Administration Shortcode |
Category: | Web Tutorial |
Sub Category: | Wordpress Administration Shortcode |
Uploaded by: | Admin |
Views: | 62 |
Reffered: https://wordpress.stackexchange.com/questions/1567/best-collection-of-code-for-your-functions-php-file