Get the plugin from wordpress.org.
Update 4: Plugin now hosted at wordpress.org.
Update 3: New version with support for viewport constants, and iPod Touch.
Update 2: James Craig points out that the ID attribute is not allowed in the META element, so I’ve updated the plugin.
Update: I should add what my aim is. Rather than creating a separate template for mobile, I want to have a theme that ‘does the right thing’ for iPhone and desktop browsers.
Some documentation:
- Plugin tests user agent string.
- If it contains ‘iPhone’ then it adds
<meta content="width=480; maximum-scale=0.6667" name="viewport"/>to the document’s head. - It also adds iPhone specific CSS rules. For that reason, you should call wp_head() in your theme file after you declare your default CSS files.
- These rules were written with Sandbox in mind. You will want to edit the CSS rules to suit your theme.
- You can force the viewport and CSS rules by adding
forceiphone=yto the query string portion of a URL.
- If it contains ‘iPhone’ then it adds
- Adds a boolean function:
weh_is_iPhone().- Returns true if user agent string contains ‘iPhone’.
- You can call this function from your theme to add or turn off generation of markup.
- Most likely you’ll use it to turn off generation of sidebars.

6 Comments
Thanks for doing this…works great!
ID is invalid on a META element.
James, thanks for pointing that out. I’ve updated the plugin.
I also just heard (from a good source) that semi-colons are invalid and all those internal delimiters should be commas. That was news to me.
Ex: “width=480; maximum-scale=0.6667″
Becomes: “width=480, maximum-scale=0.6667″
At the moment I do not have a iPhone but i would like to develop content for it so i downloaded iphoney and viewed my site with your plugin (it looks no different ) am I doing something wrong ? what emulator do you use ?
dear bill, how do i adjust the plug so that the background image of the site will not be loaded? i really like the plugin, but the background image destroys everything….