Skip to content

Instantly share code, notes, and snippets.

@teolopez
Created July 26, 2013 01:24
Show Gist options
  • Save teolopez/6085298 to your computer and use it in GitHub Desktop.
Save teolopez/6085298 to your computer and use it in GitHub Desktop.
Custom login form and site lock down
<?php
// ----------------------------------------------------------------------------------------
// Redirect all non-logged-in users to the login page (private site). Add to functions.php.
// ----------------------------------------------------------------------------------------
function admin_redirect() {
if ( !is_user_logged_in()) {
wp_redirect( home_url('/wp-login.php/') );
exit;
}
}
add_action('get_header', 'admin_redirect');
// ------------------------------------------------
// Custom login for theme and change logo url link
// ------------------------------------------------
function childtheme_custom_login() {
echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('stylesheet_directory') . '/customlogin.css" />';
echo '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>';
?>
<script type="text/javascript">$(document).ready(function(){
//$('#login').css("display","none");
$('#login').hide();
$('#login').delay(500).fadeIn(700);
});</script>
<?php }
add_action('login_head', 'childtheme_custom_login');
function loginpage_custom_link() {
$sitedomain = get_bloginfo('url');
return $sitedomain;
}
add_filter('login_headerurl','loginpage_custom_link');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment