http://wordpress.org/extend/plugins/wptouch/ watch the source and copy what they do, you can't go wrong.
FYI WPTouch is just the tip of the iceberg when it comes to mobile optimizing Wordpress for mobile. It's really more suited to the blogging side of WordPress. It doesn't offer any of the box click to call buttons, mobile friendly forms, gps enabled directions, etc
Many people just rely on using a responsive theme for being mobile, but again thats not truly mobile optimizing your site.
Responsive gets your foot in the door but being mobile ready and mobile optimized have extreme differences in terms of end user experience, and overall performance.
WPTouch is adaptive and changes its layout to be more mobile friendly depending on the visitors user agent. A true mobile optimized and adaptive approach would change the laying to suit the device that's viewing it, so for example the source code it renders would be different for a smartphone then it would be for a feature phone, or even an old school flip phone. A true adaptive approach ensures that it presents the most compatible layout for that mobile device currently viewing it.
An adaptive site would also present actual mobile optimized content too. Unlike a responsive theme that delivers content that's originally formatted for desktop browsers, instead of scaling the images down, an adaptive layout will present an image specifically formatted for mobile. So that the image is much more lightweight.
There's a lot more that goes into it than jut that but at least you get the general gist.
Hope that helps.
Uke