Want to start off by saying I am not proficient in PHP at all so I apologise if my terminology and understanding is very poor.
I’m using WordPress with a theme called Kicker. With this theme, when a user tries to login/signup to my website they are presented with a pop-up form. This pop-up form is showing my main logo, which is white, and is showing it on the white background. I’m wanting to change the logo to the alternate one which is dark but I am very unsure how to.
The file I found is called ‘tpl.login-popup.php‘ and I have found the part of code which calls for the template where this image is located:
<?php
// Logo
get_template_part( apply_filters( 'kicker_filter_get_template_part', 'templates/header-logo' ) );
?>
Now from what I understand, this is trying to get the logo from ‘templates/header-logo‘ and here is the contents of that PHP file called ‘header-logo.php:
<?php
/**
* The template to display the logo or the site name and the slogan in the Header
*
* @package KICKER
* @since KICKER 1.0
*/
$kicker_args = get_query_var( 'kicker_logo_args' );
// Site logo
$kicker_logo_type = isset( $kicker_args['type'] ) ? $kicker_args['type'] : '';
$kicker_logo_image = kicker_get_logo_image( $kicker_logo_type );
$kicker_logo_text = kicker_is_on( kicker_get_theme_option( 'logo_text' ) ) ? get_bloginfo( 'name' ) : '';
$kicker_logo_slogan = get_bloginfo( 'description', 'display' );
if ( ! empty( $kicker_logo_image['logo'] ) || ! empty( $kicker_logo_text ) ) {
?><a class="sc_layouts_logo" href="<?php echo esc_url( home_url( '/' ) ); ?>">
<?php
if ( ! empty( $kicker_logo_image['logo'] ) ) {
if ( empty( $kicker_logo_type ) && function_exists( 'the_custom_logo' ) && is_numeric( $kicker_logo_image['logo'] ) && $kicker_logo_image['logo'] > 0 ) {
the_custom_logo();
} else {
$kicker_attr = kicker_getimagesize( $kicker_logo_image['logo'] );
echo '<img src="' . esc_url( $kicker_logo_image['logo'] ) . '"'
. ( ! empty( $kicker_logo_image['logo_retina'] ) ? ' srcset="' . esc_url( $kicker_logo_image['logo_retina'] ) . ' 2x"' : '' )
. ' alt="' . esc_attr( $kicker_logo_text ) . '"'
. ( ! empty( $kicker_attr[3] ) ? ' ' . wp_kses_data( $kicker_attr[3] ) : '' )
. '>';
}
} else {
kicker_show_layout( kicker_prepare_macros( $kicker_logo_text ), '<span class="logo_text">', '</span>' );
kicker_show_layout( kicker_prepare_macros( $kicker_logo_slogan ), '<span class="logo_slogan">', '</span>' );
}
?>
</a>
<?php
}
I’m wondering if there’s an easy way I can edit something to allow the ‘tpl.login-popup.php‘ file to request the other image? I was thinking I could try and edit the header-logo.php file but then I am worried it would affect other parts of the website.
I’m sorry if this doesn’t make sense, but I thought I would try and ask. Please let me know if I can provide more information.
Thank you.
>Solution :
Without seeing all the code it is difficult to see if modifying these files would affect other spots of your site.
Your "header-logo.php" file is checking to see if you uploaded a custom logo and setting the values to display the logo, alt tag and description. If you are able to find where you upload your logo you could swap it there (but it would be for all logo uses in your site).
If you want the logo changed only in this specific location, you could simply hard code the image of choice as follows:
<?php
// Logo
// add slashes in front of next line to comment out original logo
// get_template_part( apply_filters( 'kicker_filter_get_template_part', 'templates/header-logo' ) );
?>
<img src="YOUR_LOGO_ADDRESS_HERE" alt="ALT TEXT OF YOUR IMAGE" width="ENTER_DESIRED_WIDTH" height="ENTER_DESIRED_HEIGHT" />