HI
Following some previous threads, I have been trying to implement an alternative logo for mobile use.
in Functions.php file in Appearance > Editor I put:
add_filter('avf_logo_subtext', 'kriesi_logo_addition');
function kriesi_logo_addition($sub) {
$sub .= "<a href='#'><img src='LINK TO SECOND LOGO' /></a>";
return $sub;
}
and in the CSS
@media only screen and (min-width: 480px) {
.second-logo { display: none; }}
@media only screen and (max-width: 480px) {
.logo a { display: none!important; }
.logo a.second-logo {
display: block!important;
}
}
But this isn’t working, it just removes the logo from the mobile view but doesn’t put in the second logo.
many thanks
Peter
Hey envapk2!
You’ll need this instead.
add_filter('avf_logo_subtext', 'kriesi_logo_addition');
function kriesi_logo_addition($sub) {
$sub .= "<a href='#' class = 'second-logo'><img src='LINK TO SECOND LOGO' /></a>";
return $sub;
}
And then change your CSS to this.
@media only screen and (min-width: 480px) {
.second-logo { display: none; }
}
@media only screen and (max-width: 480px) {
.logo a:first-child { display: none!important; }
.logo a:last-child {
display: block!important;
}
}
Regards,
Elliott
Hi Elliott
I tried that but it has no effect, the original logo is not replaced on the mobile.
Peter
Hi Peter!
Could you post a link to the site in question so that we can have a closer look please?
Regards,
Rikard
Hi Rikard
Sorry, I had a typo in the functions.php code – it is working fine now. Thanks for you help.
Peter