1

In the code below (which is located in my functions.php file), in reference to ('.get_bloginfo('template_url').', I'm trying to target my child theme but it keeps coming up as the parent theme.

/* ==  Custom Login Logo ==============================*/
function custom_login_logo() {
    echo '<style>
        .login h1 a { background:url('.get_bloginfo('template_url').'/images/logo-white.png) 0 0;background-size:218px 32px;height:32px;margin-bottom:10px;margin-left:20px;padding:0;width:218px }
    </style>';
}
add_action('login_head', 'custom_login_logo');

How can I make it so it targets the child theme's theme folder?

1 Answer 1

7

Try get_stylesheet_directory_uri(); which

Retrieves stylesheet directory URI for the current theme/child theme

/* ==  Custom Login Logo ==============================*/
function custom_login_logo() {
    echo '<style>
        .login h1 a { background:url('.get_stylesheet_directory_uri().'/images/logo-white.png) 0 0;background-size:218px 32px;height:32px;margin-bottom:10px;margin-left:20px;padding:0;width:218px }
    </style>';
}
add_action('login_head', 'custom_login_logo');

You might need to modify the path to your image slightly depending on it's place in your theme's folder structure

1
  • Awesome, thank you! I'll give you the check in 6 min.
    – Desi
    Mar 21, 2014 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.