Tagged: mobile menu logo
Hello,
I have inserted code below to my website, but it doesn’t work. What could be the problem?
add_filter('avf_logo','av_change_logo');
function av_change_logo($logo)
{
if(wp_is_mobile() )
{
$logo = "http://kriesi.at/wp-content/themes/kriesi/images/logo.png";
}
return $logo;
}
And you really want a different logo for mobile devices ( ipad, iphone, smartphones, tabletts etc) and not a logo for smaller screens?
i think your code is correct – anyway you can test this in your functions.php of your child-theme:
function avia_custom_mobile_logo(){
if(wp_is_mobile()){
?>
<script>
jQuery(".logo img").attr("src", "https://www.domain.com/wp-content/uploads/logo-for-mobile.png");
</script>
<?php
}
}
add_action('wp_footer', 'avia_custom_mobile_logo');
or with the filter :
add_filter('avf_logo','mobile_logo_url');
function mobile_logo_url($url){
if(wp_is_mobile()){
$url = "https://www.domain.com/wp-content/uploads/logo-for-mobile.png";
}
return $url;
}