iPhone Viewport Meta Plugin for WordPress

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:

  1. 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=y to the query string portion of a URL.
  2. 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.

Possibly Related posts (machine generated):

  1. iphone-viewport-meta plugin 0.7
  2. iPhoneDevCamp, WordPress, and Sandbox
  3. iPhone Viewport Meta now on wordpress.org
  4. iphone-viewport-meta 0.8.1
  5. iPhone Screen Caps

More like this: , , , , , .

  • 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....
  • 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 ?
  • 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"
  • James, thanks for pointing that out. I've updated the plugin.
  • ID is invalid on a META element.
  • Thanks for doing this...works great!
blog comments powered by Disqus