Mowser, mi Primer Plugin de Wordpress, y demás coincidencias November 16, 2007
Posted by Iñigo in : Uncategorized , trackbackLlevo usando Mowser desde hace un tiempo para ver cómodamente webs en el móvil.

Leyendo el blog de Russell Beattie (el autor de Mowser) me encontré con un trozo de código para detectar si una página se ve desde un móvil, y en unos 15 minutos tenía hecho mi primer plugin de Wordpress…
… y un par de minutos antes de mandárselo a Russell, leo en su blog que ha escrito un plugin para mowserizar un blog de Wordpress a la vez que yo (eso sí, lo ha hecho en 10 minutos – se nota quién se gana el pan programando y quién no).
Los dos plugins se parecen muchísimo – la diferencia es que yo he enganchado mi plugin interceptando ‘init’ (antes de que Wordpress empiece a hacer nada con la plantilla), y Russell ha interceptado ‘template_redirect’; supongo que así se puede entrar en la administración de Wordpress – el /wp-admin/ – sin pasar por Mowser.
Cosas como ésta dan que pensar… ¿seguro que la rueda la inventó una sola persona?




Comments
What a coincidence! Though I’d like to say that there was a real reason for me using template_redirect, there really wasn’t – I just copied an example redirect plugin written by Matt which used that as well. In theory, you should be able to use Mowser to log into the admin pages as well, so maybe intercepting init would be a better option (though I’d have to test it out).
There’s lots of other stuff I want to add – like an admin form for the admob ID, and header options… so I’ll play with the init stuff next as well.
-Russ
p.d. Puedo hablar y leer bastante bien in espanol, pero no puedo escribir muy bien, entonces, yo prefiero escribir sobre las cosas tecnicas en ingles.
Hi Russ,
I think choosing the right hook is the hardest thing yo have to do writing a WP plugin.
In theory, init, gets called before sending anything to the client so – it should eat a bit less cpu. Great for shared hosting.
Feel free to write here in the languaje you find better suited for human communication