Support » Fixing WordPress » functions.php change logo and link login page

Viewing 5 replies - 1 through 5 (of 5 total)
  • Michael

    (@alchymyth)

    Forum Moderator

    a:
    have you tried to set the width and height of the h1 a element in the login?

    this is the original code:

    h1 a {
    	background: url(../images/logo-login.gif) no-repeat top center;
    	width: 326px;
    	height: 67px;
    	text-indent: -9999px;
    	overflow: hidden;
    	padding-bottom: 15px;
    	display: block;
    }

    if you are able to overwrite the background image, you should be able to overwrite the other values as well.
    if needed, use the !important on each of the styles.

    b:
    in your second block of code, change all quotation marks to normal straight ' ones (example 'url').

    copying from articles does sometimes bring the ‘nice’ quotes (example ‘url’) with it – which will not work in the code.

    How could I not have noticed that…. stupido!

    // verander WP-Logo login.php
        function my_custom_login_logo() {
        echo '<style type="text/css">
        h1 a { background-image:url('.get_bloginfo('template_directory').'/images/pad-naar-logo.png) !important; }
        </style>';
        }
        add_action('login_head', 'my_custom_login_logo');
    
        // verander de url op de login pagina
        function put_my_url(){
        return ('http://www.yourdomain.nl/'); // verander in de url van je website
        }
        add_filter('login_headerurl', 'put_my_url');

    Works like a charm, no more editing core files after a WP update.

    Thanks for reply!
    Paul

    Michael

    (@alchymyth)

    Forum Moderator

    if you have both issues fixed, please mark this thread as resolved – thanks.

    Hi kortschot and alchymyth
    Great work both of you! I just wanted to add something else to this, seeing as I found this via Google and I guess other’s will too. Also, can’t see anyone else having mentioned this in other related posts, which are now all locked down.
    When you hover over the image, it still shows Powered by WordPress; so I added extra code to change this too, extending what you guys did above:

    //changing the logo
    function my_custom_login_logo() {
        echo '<style type="text/css">
        h1 a { background-image:url('.get_bloginfo('template_directory').'/images/your-logo.png) !important; }
        </style>';
        }
        add_action('login_head', 'my_custom_login_logo');
    
        // changing the login page URL
        function put_my_url(){
        return ('http://www.yourdomain.com/'); // putting my URL in place of the WordPress one
        }
        add_filter('login_headerurl', 'put_my_url');
    
    // changing the login page URL hover text
        function put_my_title(){
        return ('Name of Your Website'); // changing the title from "Powered by WordPress" to whatever you wish
        }
        add_filter('login_headertitle', 'put_my_title');

    Feel free to close off the thread!

    Here is a way even easier than what you guys have and it avoids having to edit the functions.php file each time. Create a plugin. You can use the WordPress Codex and the various key terms used for other aspects of a website.

    /*
    Plugin Name: Custom Login Link and Hover
    Plugin Author: Nicole Santillo of PittBull Secure Technologies
    Description: Changes the default login link of wordpress.org to your blog's domain.
    Version: 1.0
    */ 
    
    // changing the login page URL
        function put_my_url(){
        return bloginfo('url'); // changes the url link from wordpress.org to your blog or website's url
        }
        add_filter('login_headerurl', 'put_my_url');
    
    // changing the login page URL hover text
        function put_my_title(){
        return bloginfo('name'); // changing the title from "Powered by WordPress" to whatever you wish
        }
        add_filter('login_headertitle', 'put_my_title');

    This avoids having to change the code every time you create a new site either for yourself or for someone else.

    The code above will also work in your functions.php but I find doing this as a plugin easier for me because i don’t have to keep adding it every time for each client. It is just a quick upload.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘functions.php change logo and link login page’ is closed to new replies.