Archived topic
replace logo login
8 replies · Started by Sebastien on April 30, 2019
hey
I would like use this code:
// changing the login page URL
function put_my_url(){
return ('HTTP://WWW.YOUR-DOMAIN.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');
but I would like to replace put_my_title ; put_my_url ; http://WWW.YOUR-DOMAIN.COM/ by the values I've already saved in my Theme.
The aim is to generate the login's logo-title-url directly with the theme's datas.
could you help me? where can I find this kind of doc?
up: any ETA for theme update?? =)
Hi there,
Just to confirm, are you wanting to use the logo you added in the Customizer as the login logo?
Hi Tom,
Yes I want use :
* the logo added in the customizer as login logo
* the title added in the customizer as text when hover the login logo
* the link of my website (font-end / home) as link when clicking onto the login logo
thanks for interest !
Another try:
Can we expect GP theme update in days, weeks, months? :)
Try this:
add_filter( 'login_headerurl', function() {
return site_url();
} );
add_filter('login_headertitle', function() {
return get_bloginfo( 'name' );
} );
add_action( 'login_enqueue_scripts', function() {
$logo = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' );
$logo_url = $logo[0];
?>
<style type="text/css">
#login h1 a, .login h1 a {
background-image: url(<?php echo $logo_url; ?>);
height:65px;
width:320px;
background-size: 320px 65px;
background-repeat: no-repeat;
}
</style>
<?php
} );
For the logo, you need to adjust the height, width and background-size.
We're a couple weeks away from a beta theme version.
thanks you so much for the code and for the information about the ETA !
it helps me to take the good decision ;)
You're welcome :)
Hi,
https://generatepress.com/forums/topic/replace-logo-login/#post-886774
Does this code need to be added via a hook? Or using a code snippets plugin?
Cheers,
Matt
Hi there,
it needs to be added to the Code Snippets plugin or your Child Theme functions.php if you have one.