• Resolved shake123

    (@shake123)


    Hi – I’m keen to make use of this plugin, but would like to find out – is it possible to set a background picture for the login page?

    I know I can change the logo on the login, but I would like to also configure a background image, to keep my site’s branding consistent.

    Or if not possible via configuration, is there a way to edit the css to make this happen?

    Thanks in advance.

    https://www.ads-software.com/plugins/password-protected/

Viewing 9 replies - 1 through 9 (of 9 total)
  • There is no configuration to do this, but the login page will have a class on the body tag ‘login-password-protected’ so you can add styles to your theme to style it.

    .login-password-protected {
     background-image: url( my-image.jpg );
    }
    Thread Starter shake123

    (@shake123)

    Hi Ben – thanks for the tip. But I’ve just tried your suggestion, and it doesn’t seem to work.

    Also, inspecting the page (using Chrome’s Developer Tools) seems to indicate that it doesn’t even load my site theme’s css. I do see this loaded:
    /wp-admin/css/login.min.css

    But I don’t think I can modify this css file without manually FTP-ing into the web server (which I don’t have access to).

    I’m not a web developer though, so maybe I’m missing something…

    Any ideas?

    I’m also interested in doing this, but have no custom css support in my theme. Have tried adding this in to style.css of my theme but no luck.

    Any help would be appreciated.

    Sorry, you’re right, it doesn’t load the theme stylesheet.
    You could add something like the following to your theme’s functions.php file to output extra styling into the HTML header (where my-image.jpg is in your them,e folder):

    <?php
    
    function my_password_protected_login_head() {
       ?>
       <style>
       .login-password-protected {
          background-image: url( <?php echo get_stylesheet_directory_uri(); ?>/my-image.jpg );
       }
       </style>
       <?php
    }
    add_action( 'password_protected_login_head', 'my_password_protected_login_head' );
    
    ?>

    Hello, thanks for the lead – i have not yet tried it, nut also want to target the css to remove the white block around the password etc.
    Any ideas on how to do that if it is not loading my CSS?
    Where can we put this css so that it will work?

    Thanks.

    @quintinm You could follow the example above and put your styles in-between the <style> tags.

    The next version of the plugin (version 2.0) will try to load a ‘password-protected-login.css’ from your theme folder if it exists.

    So you can just add a ‘password-protected-login.css’ stylesheet file to your theme and place any style customisations in there.

    Hi Ben

    I would be interested in knowing how I can add a desktop background screen to the password protected screen.

    I have limited knowledge of PHP, but would be keen to understand where the code above would need to be inputted.

    Please can you advise.

    Kind regards
    Ali

    Since version 2.0, Password Protected will look for a stylesheet called password-protected-login.css in your active theme.

    If you create a stylesheet there you can included any CSS for your login screen without needing to add any PHP code.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Possible to set background picture?’ is closed to new replies.