I talked about Alex King wrote a plugin named WordPress Mobile Edition plugin. That plugin redirects connections from wireless devices to a mobile friendly interface which is a standalone page. The content is queried directly from database by sql commands in “wp-mobile.php”. I don’t like that, It breaks maintainability of the source code.
I preferred to make another theme for mobile devices, and keep the permalinks but not a “wp-mobile.php?p=postid” link. Therefore, I make another plugin based on Alex King’s work, the plugin will make people who use wireless devices automatic switch to another theme called “mobile”. The theme uses a clean and simple HTML/CSS templates without any image. It does not have a rich interface for Desktop PC, but it’s good for wireless devices. It’s fit for small screen and less data to transfer, that save money for people who visit web site by GRPS, 3G or the other mobile data network services which charge people by packets.
The basic idea of the plugin is checking what kind of user agent the visitor is using, if the visitor is using Symbian, Windows CE, BlackBerry, Palm or Opera Mini, then make wordpress switch another theme for the visitor (so called mobile device friendly interface). I use the user agent list that Alex King collected, but I will added more devices as soon as I have more free time to do that. There is a project call WURFL, that is a database of wireless device capabilities. The project has a big list of user agent string. I will try to find out the devices that the plugin missed.
I also created a simple theme for mobile devices, but I did that careless. The theme can be improved. I’m not familiar with wordpress theme. If you are good with making wordpress theme, please consult Mobile Web Best Practices and help me to improve the templates. Patch is welcome. 🙂
All right, you can download my plugin from wp-mobile-0.1.zip. Installation is pretty easy, please follow the instructions.
- Download the ZIP file. Unpack the ZIP file.
- Upload wp-mobile.plugin.php to your plugins directory.
- Upload mobile directory to your theme directory.
- Activate the plugin from within WordPress.