Moblizing your website…

Comments Off    Share on Facebook
ShortLink:

Well there are a couple of ways to do this that are pretty straight forward and easy.  One is using the carrington mobile plugin in wordpress, but dang if you install the plugin from wordpress you can’t or I can’t find the instructions to save my life, so therefore here are the installation instructions in brief so I will remember without pulling out my 40 year old (it is more precious that it used to be) hair! Disclaimer here: I didn’t write the Crowd Favorite and I don’t support it, be happy to write you one, tweak your version or something else, but that’d cost you, maybe not much, but probably not for free! I just put this for my own selfish memory reasons…

== Installation == (link to their readme.txt file) or AlexKing

1. Drop the wp-mobile.php file in your wp-content/plugins directory
2. Drop the carrington-mobile-(version #) directory in your wp-content/themes directory
3. Click the ‘Activate’ link for WordPress Mobile Edition on your Plugins page (in the WordPress admin interface)

Below this I created my own mobile redirect which works like a champ, but it requires a whole lot of work in a different sort of way, yet allow complete or more complete control. The Mike Industries Mobilize Make Your Site Mobile-Friendly in Two Minutes, well I never got it to work and apparently it gets a lot of traffic and there is no support!

Below is the nifty code you need to insert at the very top of your index page or include it prior to any html or anything else on the page and you will need to set up the new mobile page you are sending them to.  usually make that page to be 320px wide max and set that in the meta as well as the body tags.

something like this on the landing page mobile.php in the

<head>

<meta content=”width=320, user-scalable=no” name=”mobileview”>

</head>

<body>

<div id=”mobile” style=”width:320px; border:#3F0079 thin solid;”>

your content goes here!

</div>

<?PHP $mobile_browser = '0'; IF(PREG_MATCH('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|iPhone|iPad)/i', STRTOLOWER($_SERVER['HTTP_USER_AGENT']))){ $mobile_browser++; } IF((STRPOS(STRTOLOWER($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml')>0) or ((ISSET($_SERVER['HTTP_X_WAP_PROFILE']) or ISSET($_SERVER['HTTP_PROFILE'])))){ $mobile_browser++; } $mobile_ua = STRTOLOWER(SUBSTR($_SERVER['HTTP_USER_AGENT'],0,4)); $mobile_agents = ARRAY( 'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac', 'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno', 'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-', 'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-', 'newt','noki','oper','palm','pana','pant','phil','play','port','prox', 'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar', 'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-', 'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp', 'wapr','webc','winw','winw','xda','xda-','gecko','iPad','iPhone'); IF(IN_ARRAY($mobile_ua,$mobile_agents)){ $mobile_browser++; } IF (STRPOS(STRTOLOWER($_SERVER['ALL_HTTP']),'OperaMini')>0) { $mobile_browser++; } IF (STRPOS(STRTOLOWER($_SERVER['HTTP_USER_AGENT']),'windows')>0) { $mobile_browser=0; } IF($mobile_browser>0){ // do something header( 'Location: http://yourwebsite.com/mobile.php' ) ; //this is where you are sending them } ELSE { // do something else here if you want } ?>

Comments are closed.