0

I am looking for a script or plugin that disable loading thumb in mobile browser but load thumb on desktop browser.

Clearly, in a wordpress website, if I visit a website in desktop browser then website homepage post will load thumb and if I visit this site in mobile browser then website homepage post will not load thumb.

How can I stop loading thumb in mobile? Thanks in advanced. Sorry for bad English.

2

1 Answer 1

0
<?php
  /* if its not mobile */
  if ( !wp_is_mobile() ) {
  /* load and show the post thumbnail */
     the_post_thumbnail();
  }
?>

You can read on wp_is_mobile here and on the the_post_thumbnail here

1
  • wp_is_mobie is a bad thing to use as you should not detect device type on server side, just on client side. It might specifically break caching depending on how the caching is done. Commented Dec 27, 2015 at 10:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.