feat: enhance login screen customization
Added functions to customize the login screen with a custom logo, a custom URL for the logo, and a title attribute. This provides a branded and cohesive user experience on the login page. Reformatted existing functions to improve readability and consistency.
This commit is contained in:
parent
1ce2fc1332
commit
142e96e22a
1 changed files with 41 additions and 3 deletions
|
@ -639,20 +639,23 @@ function rename_excerpt_to_abstract($translated)
|
|||
|
||||
add_filter('gettext', 'rename_excerpt_to_abstract');
|
||||
|
||||
function add_custom_download_endpoint() {
|
||||
function add_custom_download_endpoint()
|
||||
{
|
||||
add_rewrite_rule('^download/([0-9]+)/?', 'index.php?download_file=$matches[1]', 'top');
|
||||
}
|
||||
|
||||
add_action('init', 'add_custom_download_endpoint');
|
||||
|
||||
function add_download_query_var($vars) {
|
||||
function add_download_query_var($vars)
|
||||
{
|
||||
$vars[] = 'download_file';
|
||||
return $vars;
|
||||
}
|
||||
|
||||
add_filter('query_vars', 'add_download_query_var');
|
||||
|
||||
function handle_file_download() {
|
||||
function handle_file_download()
|
||||
{
|
||||
$file_id = get_query_var('download_file');
|
||||
|
||||
if ($file_id && is_numeric($file_id)) {
|
||||
|
@ -683,3 +686,38 @@ function handle_file_download() {
|
|||
}
|
||||
|
||||
add_action('template_redirect', 'handle_file_download');
|
||||
|
||||
function custom_login_logo()
|
||||
{
|
||||
$custom_logo_id = get_theme_mod('custom_logo');
|
||||
$logo_url = wp_get_attachment_image_url($custom_logo_id, 'full');
|
||||
?>
|
||||
<style type="text/css">
|
||||
#login h1 a,
|
||||
.login h1 a {
|
||||
background-image: url(<?php echo esc_url($logo_url); ?>);
|
||||
height: 65px;
|
||||
width: auto;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
padding-bottom: 30px;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
|
||||
add_action('login_enqueue_scripts', 'custom_login_logo');
|
||||
|
||||
function custom_login_logo_url()
|
||||
{
|
||||
return home_url();
|
||||
}
|
||||
|
||||
add_filter('login_headerurl', 'custom_login_logo_url');
|
||||
|
||||
function custom_login_logo_url_title()
|
||||
{
|
||||
return get_bloginfo('name');
|
||||
}
|
||||
|
||||
add_filter('login_headertext', 'custom_login_logo_url_title');
|
||||
|
|
Loading…
Reference in a new issue