Hi Omatzyo,
A few days ago i installed the zenphotoiphone theme. Just wanted to give you a very positive feedback. It works like a charm. However you may want to update the install instructions to make it work for more mobile devices than just the iphone. I used the script provided by http://detectmobilebrowsers.mobi/ (free for personal use) and i can browse the site with an android device. Thanks again.
I understand this script can't be shipped with neither zenphoto nor zenphotoiphone. However i was only suggesting to omatzyo to update the install instructions to include a reference to this script -- or any other script by the way (i didn't search very long as this one popped up immediately). While there is a large base of iphone users, there is also a lot of other mobile os users. Just my 2 cents..
Indeed. Actually i just realized that modifying zp functions.php core file might not needed. Shouldn't we use a setupTheme filter instead?
That filter could be provided with zenphotoiphone. If the script detection is found then we use it, otherwise we use the simple iphone detection switch. I guess this would simplify the theme installation.
That way it would be up to the user to download the detection script and abide to the license agreement. I'm gonna try that tonight and will come back to you (whether i succeed or not).
There is a filter load_theme_script already that probably could be used for this. Zenphoto 1.3.2 (scheduled for January now) will also include a theme_head filter to load other css for example. See the user guide plugin documentation for the complete filter list
I didn't find the load_theme_filter, but i came up with a somehow functional POC that involves at least two filters (a controller and a list of voters). The latter decide if the client is a mobile device.
I registered a listener on 'setupTheme'. In the "setupTheme" event handler (the "controller"), the 'mobile_detector' event is fired. It is handled by the "voters". If there is at least one filter that votes for a mobile device, the mobile theme is applied.
The said mobile theme is defined by the user through an option exposed by the "controller".
I paste the controller and a voter example below. Please feel free to move the code elsewhere if you find it more appropriate.
The "controller" :
`
`
It is done. The plugin can be downloaded here: http://gilles.dodinet.fr/news/mobile-theme-filter
I've also changed the code slightly and fixed a few bugs. The article linked above also includes some minimal doc.
Regards