Hi!
I have tried to add the following code to functions.php in order to replace the logo for mobile devices:
add_filter('avf_logo','av_change_logo');
function av_change_logo($logo)
{
if(wp_is_mobile() )
{
$logo = "source";
}
return $logo;
}
Unfortunately, this is replacing also the logo on tablets. I want to customize this code to exclude any tablets. I want the custom logo to appear only on smartphones.
I searched and found an article about excluding tablets but not sure how to adapt this to Enfold http://wordpress.stackexchange.com/questions/114369/excluding-ipad-from-wp-is-mobile
Anyone could help me with this?
Hi L!
Please add following code to Functions.php file of your child theme instead
function av_dif_mobile_logo(){
?>
<script>
jQuery(window).load(function(){
if (jQuery(window).width() < 480) {
jQuery(".logo img").attr("src", "http://kriesi.at/wp-content/themes/kriesi/images/logo.png")
}
});
</script>
<?php
}
add_action('wp_footer', 'av_dif_mobile_logo');
Cheers!
Yigit
Hey L!
Please take a look at the following plugin, which let you add different placments per device:
https://wordpress.org/plugins/mobble/
is_handheld(); // any handheld device (phone, tablet, Nintendo)
is_mobile(); // any type of mobile phone (iPhone, Android, Nokia etc)
is_tablet(); // any tablet device (currently iPad, Galaxy Tab)
is_ios(); // any Apple device (iPhone, iPad, iPod)
Let us know if that works out for you
Best regards,
Basilis
Thanks Yigit! This did the job perfectly! I will also try out the plugin suggested by Basilis.