Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to figure out how to include a stylesheet instead of echo'ing <style> tags.

I'm currently using the following function:

// Custom Login Styles
function login_styles() {
    echo '<style type="text/css">
        h1 a {
            background: url('.get_template_directory_uri().'/etc/images/logo_login.png) center center no-repeat !important;
            display: block !important;
            height: 50px !important;
            margin: 0 auto 10px !important;
            position: relative;
            width: 131px !important;
        }
        .login #nav a, .login #backtoblog a {
            color: #FFF !important;
            text-shadow:none;
            text-decoration: none;
        }
        .login #nav a:hover, .login #backtoblog a:hover {
            color: #000 !important;
            text-shadow:none;
            text-decoration: none;
        }
        .login #backtoblog a {
            display:none;
        }
        body.login {
            background-color: #2F2F2F;
        }
        .login form {
            background-color: rgba(255, 255, 255, 0.6) !important;
            border-radius: 0 !important;
        }
        .login .message {
            border-radius: 0 !important;
            background: linear-gradient(to bottom, #7007B6 0%, #805B98 100%) repeat scroll 0 0 #16B4F1 !important;
            border-color: #7007B6 !important;
            color:#FFF !important;
            box-shadow:0 1px 0 rgba(120, 200, 230, 0.5) inset;
        }
        .login form .input, .login input[type="text"] {
            border-radius:0px !important;
        }
        .login h1 a {
            background-size: auto !important;
        }
        .login label {
            color: #2F2F2F;
            font-size: 14px;
        }
        .wp-core-ui .button-primary {
            border-radius: 0px !important;
            border-color: #7007B6 !important;
            box-shadow: 0 1px 0 rgb(127, 84, 155) inset;
            background: #805B98 !important; /* Old browsers */
            background-image: -moz-linear-gradient(top,  #805B98 0%, #7007B6 100%) !important; /* FF3.6+ */
            background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#805B98), color-stop(100%,#7007B6)) !important; /* Chrome,Safari4+ */
            background-image: -webkit-linear-gradient(top,  #805B98 0%,#7007B6 100%) !important; /* Chrome10+,Safari5.1+ */
            background-image: -o-linear-gradient(top,  #805B98 0%,#7007B6 100%) !important; /* Opera 11.10+ */
            background-image: -ms-linear-gradient(top,  #805B98 0%,#7007B6 100%) !important; /* IE10+ */
            background-image: linear-gradient(to bottom,  #805B98 0%,#7007B6 100%) !important; /* W3C */
        }
        .wp-core-ui .button-primary:hover {
            box-shadow: 0 1px 0 rgb(127, 84, 155) inset;
            background: #7007B6 !important; /* Old browsers */
            background-image: -moz-linear-gradient(top,  #7007B6 0%, #805B98 100%) !important; /* FF3.6+ */
            background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#7007B6), color-stop(100%,#805B98)) !important; /* Chrome,Safari4+ */
            background-image: -webkit-linear-gradient(top,  #7007B6 0%,#805B98 100%) !important; /* Chrome10+,Safari5.1+ */
            background-image: -o-linear-gradient(top,  #7007B6 0%,#805B98 100%) !important; /* Opera 11.10+ */
            background-image: -ms-linear-gradient(top,  #7007B6 0%,#805B98 100%) !important; /* IE10+ */
            background-image: linear-gradient(to bottom,  #7007B6 0%,#805B98 100%) !important; /* W3C */
        }
        input[type="checkbox"] {
            margin: -1px 0 0 0 !important;
        }
    </style>';
}

add_action('login_head', 'login_styles');

Any help is greatly appreciated..

share|improve this question
1  
Oops, silly me that should be codex.wordpress.org/Function_Reference/wp_register_style –  Waldermort Sep 18 '13 at 16:05
2  
    
Sorry, should've updated this post saying I found my answer by reading the login_head codex page; thanks! haha –  user741166 Sep 26 '13 at 13:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.