Brand Your WordPress Login Without A Plugin – Part 2
Posted by Nile | Posted in Tutorials | Posted on 08-23-2010 | 3 Comments
Tags: custom login page, login, tips
I posted how to Brand Your WordPress Login Without A Plugin, but I was asked by Ash of Ash Blue Web Design how to change the URL on the login page from WordPress to your own URL. Well, after mulling it over and since I have been coding a few WordPress plugins, I thought I would dig a bit for the solution.
After you have followed the first tutorial, here is how you can change that URL.
As a reminder, the full code from the previous tutorial is:
function my_custom_login_logo() {
echo '<style type="text/css">
h1 a { background-image:url('.get_bloginfo('template_directory').'/images/custom-login-logo.png) !important;height:160px;width:322px;margin-bottom:5px;margin-top:-70px; }
body { border-top-style:none; }
html {background:#fff url('.get_bloginfo('template_directory').'/images/bgr_html2.png) repeat-x;}
#backtoblog { display:none; }
</style>';
}
add_action('login_head', 'my_custom_login_logo');
Before the ‘; after the style tag, you will put the following javascript code, which is pretty self explanatory. We are switching one URL for the other, but specifying that it is your site’s link.
<script type="text/javascript">
function loginalt() {
var changeLink = document.getElementById(\'login\').innerHTML;
changeLink = changeLink.replace("http://wordpress.org/", "' . site_url() . '");
changeLink = changeLink.replace("Powered by WordPress", "' . get_bloginfo('name') . '");
document.getElementById(\'login\').innerHTML = changeLink;
}
window.onload=loginalt;
</script>
So, in the end, the full code is:
function my_custom_login_logo() {
echo '<style type="text/css">
h1 a { background-image:url('.get_bloginfo('template_directory').'/images/custom-login-logo.png) !important;height:160px;width:322px;margin-bottom:5px;margin-top:-70px; }
body { border-top-style:none; }
html {background:#fff url('.get_bloginfo('template_directory').'/images/bgr_html2.png) repeat-x;}
#backtoblog { display:none; }
</style>
<script type="text/javascript">
function loginalt() {
var changeLink = document.getElementById(\'login\').innerHTML;
changeLink = changeLink.replace("http://wordpress.org/", "' . site_url() . '");
changeLink = changeLink.replace("Powered by WordPress", "' . get_bloginfo('name') . '");
document.getElementById(\'login\').innerHTML = changeLink;
}
window.onload=loginalt;
</script>
';
}
add_action('login_head', 'my_custom_login_logo');








