Detect Mobile Browser and Serve Up Alternate Content (or nothing)


The site we just built for has a pretty cool slideshow feature on the home page, serving up a portion of the four most recent issues’ cover images and tables of content. But it doesn’t work well at all on small mobile devices, so Joe and I spent some time poking around the tubes until we worked this out:

Which is all based on a post we found here. (link is now dead)

(You’re going to need this file, too.)

(edit: Here’s a place to find out how to use is_mobile)

stuff we dig

FYI: yes, the above are affiliate links, so we do make a small amount of money if you follow them over and buy what they're selling. Thank you for helping pay our hosting costs!

Dave Kuhar

Dave ran Transmit Studio, a media creation lab in San José. He's built more websites with WordPress than he can remember. He's reluctantly moved back to Ohio and now works for Stanford University (remotely). He likes hearing himself talk and writing about himself in third person.


  1. Joe Mendel on September 10, 2012 at 11:47 pm

    Or, as we discovered, we could simply use wp_is_mobile.

  2. Dave Kuhar on September 11, 2012 at 9:09 am

    Turns out we’re not always the sharpest crayons in the box. Still, this code will be handy when we build non-WP sites.

Leave a Comment