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)


  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.