Customize Login Image
[resolved] WP 3.8 fix (2 posts)

  1. kitchin
    Posted 1 year ago #

    WP 3.8 switched to a small SVG logo. As a result of new style rules, the custom logo is cropped to width 80px.

    I suggest this fix for customize-login-image.php Version: 1.3. Replace lines 39-52 with a rewritten function cli_logo_file():

    function cli_logo_file() {
    	$bgimage= get_option( 'cli_logo_file' );
    	if (! $bgimage ) {
    		$upload_dir = wp_upload_dir();
    		$customize_login_image = $upload_dir['basedir'] . '/customize-login-image.png';
    		if (@file_exists($customize_login_image) && is_readable($customize_login_image)) {
    			$bgimage= $upload_dir['baseurl'] . '/customize-login-image.png';
    	if ( $bgimage ) {
    		echo '<style>
      #loginform {
    	margin-top: 0;				/* make WP 3.8 look like pre-3.8 */
      #login h1 a {
    	background-image: url("' . $bgimage . '");
    	background-size: auto;
    	width: auto;				/* needed for WP 3.8 */
    	margin: 0;				/* make WP 3.8 look like pre-3.8 */
    </style>' . "\n";

    Note, this is not a minimal fix. For a minimal fix, just add
    width: auto!important; margin: 0!important; } #loginform { margin-top: 0;
    to the styles in the original code. That will make the logo the right size, and eliminate some new vertical space in WP 3.8 between the logo and the login box.

    My fix changes:
    * Do nothing is we do not have a replacement logo. The original code puts in the WordPress logo when there is no replacement logo.
    * Switch !important to #login. I think this should always work, and it's easier to read in your browser's Inspect Element.

    Optional: if you have a logo that worked with the old white background but now looks wrong, you can try:
    background-color: #fff; /* quick fix to make WP 3.8 look like pre-3.8 */
    Or just upload a new logo that is 320px wide (untested).

    The advice in customize-login-image-options.php:
    _e( 'Enter a URL or upload logo image. Maximum height: 70px, width: 310px.', 'customize-login-image' );
    should be changed to
    _e( 'Enter a URL or upload logo image. Use an image 320px wide if you want to match the default WordPress login box.', 'customize-login-image' );


  2. apasionados
    Plugin Author

    Posted 1 year ago #

    Thanks for the fix. We have just updated the plugin and uploaded the new version.

    Finally we have decided to remove the margin of the "loginform" to make it look more like 3.8.
    We have removed:

    #loginform {
    	margin-top: 0;				/* make WP 3.8 look like pre-3.8 */

    We have also tested it in previous versions of WordPress and it Works perfectly.

    Thanks for your help!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic