Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #408391

    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

    • This topic was modified 9 years, 9 months ago by Elliott.
    #408481

    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

    #408529

    Hi Elliott

    I tried that but it has no effect, the original logo is not replaced on the mobile.

    Peter

    #408651

    Hi Peter!

    Could you post a link to the site in question so that we can have a closer look please?

    Regards,
    Rikard

    #408766

    Hi Rikard

    Sorry, I had a typo in the functions.php code – it is working fine now. Thanks for you help.

    Peter

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Alternative mobile logo’ is closed to new replies.