40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Add a custom logo and styles in login page
|
|
*
|
|
* https://developer.wordpress.org/reference/functions/the_custom_logo/#comment-2037
|
|
*/
|
|
|
|
// https://codex.wordpress.org/Customizing_the_Login_Form#Change_the_Login_Logo
|
|
function ofisuport_login_logo() {
|
|
if ( has_custom_logo() ) :
|
|
|
|
$image = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' );
|
|
?>
|
|
<style type="text/css">
|
|
.login h1 a {
|
|
background-image: url("<?php echo esc_url( $image[0] ); ?>") !important;
|
|
}
|
|
</style>
|
|
<?php
|
|
endif;
|
|
}
|
|
add_action( 'login_enqueue_scripts', 'ofisuport_login_logo' );
|
|
|
|
function ofisuport_login_logo_url() {
|
|
return home_url();
|
|
}
|
|
add_filter( 'login_headerurl', 'ofisuport_login_logo_url' );
|
|
|
|
function ofisuport_login_logo_url_title() {
|
|
return 'Your Site Name and Info';
|
|
}
|
|
add_filter( 'login_headertext', 'ofisuport_login_logo_url_title' );
|
|
|
|
// https://codex.wordpress.org/Customizing_the_Login_Form#Styling_Your_Login
|
|
function ofisuport_login_stylesheet() {
|
|
wp_enqueue_style( 'custom-login', get_stylesheet_directory_uri() . '/assets/css/style-login.css' );
|
|
// wp_enqueue_script( 'custom-login', get_stylesheet_directory_uri() . '/assets/css/style-login.js' );
|
|
}
|
|
add_action( 'login_enqueue_scripts', 'ofisuport_login_stylesheet' );
|