Dynamically change url or WordPress theme if UserAgent is iPhone
صفحه اصلي

Dynamically change url or WordPress theme if UserAgent is iPhone



Is there any way to do this?

My website is http://kennethreitz.com. Its driven by some moderate PHP on top Wordpress.

My options are to detect if the user is using an iphone, and if they are either

a) tell wordpress to load a different "theme" that i have written. b) if this isn't possible, have a different wordpress installation on a subdomain (i.kennethreitz.com) that operates out of the same database, that uses a different theme.

I'd rather be able to do A for SEO reasons.

Any ideas?


Getting phone UUID through iPhone SDK

1:

Is there a way to use C++ for iPhone development?
http://www.nathanrice.net/blog/serve-ie6-visitors-the-default-wordpress-theme/ demonstrates how to use template filter to dynamically change the WordPress theme (in this case IE6, although it could be for a mobile user agent):. Getting the visible rect of an UIScrollView's content
add_filter('template', 'serve_default_to_iesix'); add_filter('option_template', 'serve_default_to_iesix'); add_filter('option_stylesheet', 'serve_default_to_iesix');  function serve_default_to_iesix($theme) {     if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false)         $theme = 'default';     return $theme; } 
Getting first three digits from int/floatHow can a C# programmer build software for iPhone?

2:

Saving reference to UITableViewCell
Have you looked at iWPhone? . Reformatting for landscape view It's a Wordpress plugin and theme this automatically takes care of detecting whether the visitor is from an iPhone and formats things appropriately. Fade in/out UIScrollView's content like Mobile Safari does in its tabPretty easy to substitute your own custom iPhone CSS if you want, although the basic theme is pretty decent.. There's also WPTouch which looks to be similar in functionality although is a bit more recent and has better administration integration..

3:

Here is a Wordpress plugin which serves different themes to different browsers (e.g. iPhone):. http://code.kuederle.com/browserbasedthemes.

4:

I don't have experience with WordPress, although the iWPhone plugin + theme looks like it might work.

5:

Out of the box you cannot did either A or B.. Loading a different theme is not possible as this option is stored in the database under the wp_Options table. This setting is site wide not per user. Option B is not an option either since you would be sharing the same database you would be selecting the same value for the theme.. If you look in the wp_options table the theme setting will be found in the record this corresponds to "template" and "stylesheet"..


34 out of 100 based on 14 user ratings 214 reviews