Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #758905

    add_filter(‘avf_logo’,’av_change_logo’);
    function av_change_logo($logo)
    {
    if(wp_is_mobile() )
    {
    $logo = “http://domain.com/path/logo.png”;
    }
    return $logo;
    }

    I am trying to change the logo for a mobile using the function above, I have placed in the child themes function page but it does not seem to work with current version of enfold, any ideas?

    • This topic was modified 7 years, 1 month ago by web_kings.
    #758908
    function av_dif_mobile_logo(){
    ?>
     <script>
    jQuery(window).load(function(){
    if (jQuery(window).width() < 480) {
    jQuery(".logo img").attr("src", "url to the new logo")
    }
    });
     </script>
    <?php
    }
    add_action('wp_footer', 'av_dif_mobile_logo');

    try this !

    #758910

    Hey!

    Please refer to @guenni007’s post above.

    @guenni007
    Thanks as always :)

    Regards,
    Yigit

    #758922

    or maybe better:

    function avia_custom_mobile_logo(){
    if(wp_is_mobile()){
    ?>
     <script>
    jQuery(".logo img").attr("src", "http://kriesi.at/wp-content/themes/kriesi/images/logo.png")
     </script>
    <?php
    }
    }
    add_action('wp_footer', 'avia_custom_mobile_logo');
    #758948

    The first script thanks Guenni007, has a slight delay, causing a blink with the original logo being updated with the mobile logo.

    • This reply was modified 7 years, 1 month ago by web_kings.
    #758969

    Is there a way of editing the template, So I could add

    <div class="logo">
      <img src="/images/logo_desktop.png" class="desktop" />
      <img src="/images/logo_mobile.png" class="mobile />
    </div>
    

    Then use CSS to show which one?

    • This reply was modified 7 years, 1 month ago by web_kings.
    #759005

    did you try the second snippet – i think its better for your site
    or get rid of the loading case

    • This reply was modified 7 years, 1 month ago by Guenni007.
    #759116

    Hi,

    Are you using a transparent logo? If you are not, you can refer to this post – http://kriesi.at/documentation/enfold/add-subtext-to-logo-replace-logo-with-site-title/ and add your mobile using HTML version and then add following code to Quick CSS

    @media only screen and (min-width: 481px) { 
    .subtext { display: none; }
    } 
    @media only screen and (max-width: 480px) { 
    .responsive .logo > a > img { display: none; }
    }

    Please make sure that > sign is not converted to – http://i.imgur.com/IDXRZQ3.png in Quick CSS field.

    Best regards,
    Yigit

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.