0

How can I completly rewrite the markup of the login page in wordpress? I dont want to just change labels or the logo... I need to completly rewrite the structure of the page.

Thanks ahead!

1

It's not a good idea to customize directly the login page because it contains lots of important mechanisms that is better to keep working.

Even the plugins that customize the login page (A5 Custom Login Page and Custom Login for example) don't let you change the semantic structure of the page, but just take action to some graphic elements (colors, background, etc.)

So I would suggest you to change your login page via css, using the classes and the identifiers defined by wordpress and listed in the Customizing the Login Form page:

body.login {}
body.login div#login {}
body.login div#login h1 {}
body.login div#login h1 a {}
body.login div#login form#loginform {}
body.login div#login form#loginform p {}
body.login div#login form#loginform p label {}
body.login div#login form#loginform input {}
body.login div#login form#loginform input#user_login {}
body.login div#login form#loginform input#user_pass {}
body.login div#login form#loginform p.forgetmenot {}
body.login div#login form#loginform p.forgetmenot input#rememberme {}
body.login div#login form#loginform p.submit {}
body.login div#login form#loginform p.submit input#wp-submit {}
body.login div#login p#nav {}
body.login div#login p#nav a {}
body.login div#login p#backtoblog {}
body.login div#login p#backtoblog a {}

If all this still does not distract you from your purpose, you can always change the file wp-login.php into your root (I repeat: don't do it!)

1

If you want change completely the login page, it's better create another login page:

  1. create a page template with your customized login form and what else you want.
  2. in WP admin create a page, title it "Login Page" and assign the template created at 1.
  3. in functions.php put following code to redirect user to your login page:

    function my_login_redirect() {
      $loginpage = get_page_by_title('Login Page');
      global $pagenow;
      if ( $loginpage && ('wp-login.php' == $pagenow) ) {
         wp_redirect( get_permalink($loginpage) );
         exit;
      }
    }
    add_action('init', 'my_login_redirect');
    

Of course your page template must implement all the logic for authenticate users, logout them and remember password. But looking at the code of wp-login.php in the root folder of WP will sure help you in this job.

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.