[wp-hackers] Writing plugins with classes

Mark Jaquith mark.wordpress at txfx.net
Sun Feb 25 14:34:00 GMT 2007


On Feb 24, 2007, at 4:57 PM, Aaron Brazell wrote:

> Maybe someone can give me a quick pointer here. I've always wrote  
> plugins procedurally, but decided with this new one to write as a  
> class. Problem is, I'm obviously screwing up some syntax somewhere  
> because the class is being redeclared.

Don't use basename(__FILE__) as the unique string if you're  
specifying a function (or method) callback.  Just use a unique-to- 
your-management-page string.

Self-reference an object by using $this.  Your array(new myclass(),  
'admin_screen') part is probably where the problem lies.

--
Mark Jaquith
http://markjaquith.com/

Covered Web Services
http://coveredwebservices.com/




More information about the wp-hackers mailing list