Maybe sometimes we want a custom style for our Drupal login page, different with the existing default login page in Drupal 7, whether it's for a personal project or client requests.

Here is the simplest way to create a custom login page in Drupal 7.

First open the template.php and add the following code:

function yourthemename_theme() {
  $items = array();
  // create custom user-login.tpl.php
  $items['user_login'] = array(
  'render element' => 'form',
  'path' => drupal_get_path('theme', 'yourthemename') . '/templates',
  'template' => 'user-login',
  'preprocess functions' => array(
  'yourthemename_preprocess_user_login'
  ),
 );
return $items;
}

create a new folder "templates" and than creating user-login.tpl.php file and place it inside.

Open the user-login.tpl.php file and paste the following code:


add the wrapper such as div, span, etc. to test it. Don't forget to clear your Drupal cache.