This topic has 1 reply, 2 voices, and was last updated 10 years by SQadmin.

  • Author
  • #6772
     clutchnyc
    Participant

    Hi, I’m trying to create my own customizations for wp-login.php.

    I notices that in sweetdate/framework/frontend.php you have this code:


    /***************************************************
    * Customize wp-login.php
    ***************************************************/
    function custom_login_css() {
    global $kleo_sweetdate;
    echo '<style>';

    echo $kleo_sweetdate->get_bg_css('header_background', 'body.login');

    echo "\n";
    echo '.login h1 a { background-image: url("'.sq_option('logo',get_template_directory_uri().'/assets/images/logo.png').'"); background-size: 250px;width: 326px; min-height: 80px;}';
    echo '#login {padding: 20px 0 0;}';
    echo '.login #nav a, .login #backtoblog a {color:'.sq_option('header_primary_color').'!important;text-shadow:none;}';

    echo '</style>';
    }
    add_action('login_head', 'custom_login_css');

    function kleo_new_wp_login_url() { return home_url(); }
    add_filter('login_headerurl', 'kleo_new_wp_login_url');

    function kleo_new_wp_login_title() { return get_option('blogname'); }
    add_filter('login_headertitle', 'kleo_new_wp_login_title');

    My question is now can I override this? In my child theme, I want to create my own function for a login-css file for my wp-login.php. My attemps to do this are conflicting with the above code. Any advice is much appreciated!

    (I tried putting a copy of framework/Frontend.php in my child theme with the above code removed, but that didn’t work.)

    Thank you!!

    #6866
     SQadmin
    Keymaster

    Hi,
    you can remove our customization with this added to sweetdate-child/functions.php

    COPY CODE
    
    add_action('after_setup_theme', 'my_customizations');
    function my_customizations() {
    remove_action('login_head', 'custom_login_css');
    }
    

    Then you can define you own custom code based on ours:

    COPY CODE
    
    function my_custom_login_css() {
        global $kleo_sweetdate;
        echo '<style>';
        
        echo $kleo_sweetdate->get_bg_css('header_background', 'body.login');
    
        echo "\n";
        echo '.login h1 a { background-image: url("'.sq_option('logo',get_template_directory_uri().'/assets/images/logo.png').'"); background-size: 250px;width: 326px; min-height: 80px;}';
        echo '#login {padding: 20px 0 0;}';
        echo '.login #nav a, .login #backtoblog a {color:'.sq_option('header_primary_color').'!important;text-shadow:none;}';
        
        echo '</style>';
    }
    add_action('login_head', 'my_custom_login_css');
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?