Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save tasia53/f8451ee8e575272472b77c9c39b556d1 to your computer and use it in GitHub Desktop.

Select an option

Save tasia53/f8451ee8e575272472b77c9c39b556d1 to your computer and use it in GitHub Desktop.
WordPress: Custom Login
/* TargetIMC Cambiar el fondo */
body.login {
background-image: url('login-bg.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
}
/* Eliminar el enlace de volver a la Home */
p#backtoblog {
display: none;
}
/* TargetIMC Reemplazar Logo */
.login h1 {
text-align: center;
background-color: rgba(255,255,255,.9);
border-radius: 10px;
-webkit-box-shadow: 10px 10px 10px 0px #636262;
-moz-box-shadow: 10px 10px 10px 0px #636262;
box-shadow: 10px 10px 10px 0px #636262;
}
.login h1 a {
background-image: url('login-logo.png');
background-size: 250px 76px; /*Modificar aquí para que coincida con el tamaño del logo */
height: 76px; /*Modificar aquí para que coincida con el tamaño del logo */
width: 250px; /*Modificar aquí para que coincida con el tamaño del logo */
}
/* Eliminar el enlace de password olvidado */
p#nav {
display: none;
}
/* TargetIMC Cambiar el fondo */
body.login {
background-image: url('login-bg.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
}
/* TargetIMC Reemplazar Logo */
.login h1 {
text-align: center;
background-color: rgba(255,255,255,.9);
border-radius: 10px;
}
.login h1 a {
background-image: url('login-logo.png');
background-size: 250px 76px; /*Modificar aquí para que coincida con el tamaño del logo */
height: 76px; /*Modificar aquí para que coincida con el tamaño del logo */
width: 250px; /*Modificar aquí para que coincida con el tamaño del logo */
}
/*TargetIMC Fomato Caja login BOF*/
body.login div#login form#loginform {
background: #004170;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: 10px 10px 10px 0px #636262;
-moz-box-shadow: 10px 10px 10px 0px #636262;
box-shadow: 10px 10px 10px 0px #636262;
}
/*TargetIMC Fomato Caja Registro BOF*/
body.login div#login form#registerform {
background: #004170;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: 10px 10px 10px 0px #636262;
-moz-box-shadow: 10px 10px 10px 0px #636262;
box-shadow: 10px 10px 10px 0px #636262;
}
/*TargetIMC Fomato Caja Lost Password BOF*/
body.login div#login form#lostpasswordform {
background: #004170;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: 10px 10px 10px 0px #636262;
-moz-box-shadow: 10px 10px 10px 0px #636262;
box-shadow: 10px 10px 10px 0px #636262;
}
/*TargetIMC Fomato texto etiquetas dentro de la caja BOF*/
.login label {
color: #dddddd;
font-size: 14px;
font-weight: bold;
}
/*TargetIMC Fomato caja input BOF*/
.login form .input, .login input[type=text], .login form input[type=checkbox] {
background: #dddddd;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 2px 2px 2px 0px #636262;
-moz-box-shadow: 2px 2px 2px 0px #636262;
box-shadow: 2px 2px 2px 0px #636262;
}
/*TargetIMC Fomato texto tiquetas fuera de la caja BOF*/
.login #nav a, .login #backtoblog a {
text-decoration: none;
color: #004170;
font-weight: bold;
}
.login #nav a:hover, .login #backtoblog a:hover {
color: #00416f;
font-weight: bold;
}
/*TargetIMC Formato caja mensajes BOF*/
div.updated, .login .message, .press-this #message,
div.error, .login #login_error {
background: #0083CD;
color: #ffffff;
font-weight: bold;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: 10px 10px 10px 0px #636262;
-moz-box-shadow: 10px 10px 10px 0px #636262;
box-shadow: 10px 10px 10px 0px #636262;
border-left: 4px solid #004170;
}
/*TargetIMC Formato texto mensajes*/
p, .wp_attachment_details label[for=content] {
color: #dddddd;
font-size: 14px;
font-weight: bold;
line-height: 1.5;
margin: 1em 0;
}
/* Eliminar el enlace de password olvidado */
p#nav {
display: none;
}
/* Eliminar el enlace de volver a la Home */
p#backtoblog {
display: none;
}
/* Enque Stylesheet */
function my_custom_login() {
echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('stylesheet_directory') . '/login/custom-login-styles.css" />';
}
add_action('login_head', 'my_custom_login');
/*Hide the Login Error Message*/
function login_error_override()
{
return __( 'Incorrect login details.', 'targetimc' );
}
add_filter('login_errors', 'login_error_override');
/*Change the Redirect URL */
function admin_login_redirect( $redirect_to, $request, $user ) {
global $user;
if( isset( $user->roles ) && is_array( $user->roles ) ) {
if( in_array( "administrator", $user->roles ) ) {
return $redirect_to;
} else {
return home_url();
}
}
else
{
return $redirect_to;
}
}
add_filter("login_redirect", "admin_login_redirect", 10, 3);
/* Change the Login Logo URL */
function my_login_logo_url() {
return get_bloginfo( 'url' );
}
add_filter( 'login_headerurl', 'my_login_logo_url' );
function my_login_logo_url_title() {
return get_bloginfo( 'name' ) . ' | ' . get_bloginfo( 'description' );
}
add_filter( 'login_headertitle', 'my_login_logo_url_title' );
/*Set “Remember Me” To Checked */
function login_checked_remember_me() {
add_filter( 'login_footer', 'rememberme_checked' );
}
add_action( 'init', 'login_checked_remember_me' );
function rememberme_checked() {
echo "<script>document.getElementById('rememberme').checked = true;</script>";
}
/* Custom Login
------------------------------------------------------------*/
/* Enque Stylesheet */
function my_custom_login() {
echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('stylesheet_directory') . '/login/custom-login-styles.css" />';
}
add_action('login_head', 'my_custom_login');
/* Change the Login Logo URL */
function my_login_logo_url() {
return get_bloginfo( 'url' );
}
add_filter( 'login_headerurl', 'my_login_logo_url' );
function my_login_logo_url_title() {
return get_bloginfo( 'name' ) . ' | ' . get_bloginfo( 'description' );
}
add_filter( 'login_headertitle', 'my_login_logo_url_title' );
/*Hide the Login Error Message*/
function login_error_override()
{
return __( 'Incorrect login details.', 'targetimc' );
}
add_filter('login_errors', 'login_error_override');
/*Change the Redirect URL */
function admin_login_redirect( $redirect_to, $request, $user ) {
global $user;
if( isset( $user->roles ) && is_array( $user->roles ) ) {
if( in_array( "administrator", $user->roles ) ) {
return $redirect_to;
} else {
return home_url();
}
}
else
{
return $redirect_to;
}
}
add_filter("login_redirect", "admin_login_redirect", 10, 3);
/*Set “Remember Me” To Checked */
function login_checked_remember_me() {
add_filter( 'login_footer', 'rememberme_checked' );
}
add_action( 'init', 'login_checked_remember_me' );
function rememberme_checked() {
echo "<script>document.getElementById('rememberme').checked = true;</script>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment