0

I'd like to take a standard WordPress login page, change the WP logo to a custom image I create and that varies depending on site ID (WP Mulit-site).

I've found this approach: WordPress login page logo customization

function my_login_logo() { ?>
    <style type="text/css">
        body.login div#login h1 a {
            background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/images/Logo-B-Classic.jpg);
        }
    </style>
<?php }
add_action( 'login_enqueue_scripts', 'my_login_logo' );

But I'm unsure how to best customize it to:

  • Change the logo to a custom image based on site ID.
  • Change the linking URL of the logo image to a url based on site ID.

Thanks!

1
  • What you'd want to do is create an option page where you can assign the custom logo on each of the multi site installs. Oct 4, 2021 at 14:02

1 Answer 1

0

Change the code to:

function my_login_logo() {
    $site_id = get_current_blog_id();
?>
    <style type="text/css">
        body.login div#login h1 a {
            background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/images/Logo-B-Classic-<?php echo $site_id; ?>.jpg);
        }
    </style>
<?php }
add_action( 'login_enqueue_scripts', 'my_login_logo' );

Then, update the logo image file names to append the site ID accordingly to each different logo image file, for example Logo-B-Classic-21.jpg where '21' is the site ID.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.