I’m developing a plugin for a site that has to communicate with several non-wp tables in a database. For that I made a class that contains all of the MySQL-related functions.
When you declare a function within a plugin, you can easily call it within a theme. But how to do that with a class?
Is there a way to instantiate it with wordpress init and make it available to plugin(s) and theme(s)?
Thank you for your time! 🙂
Ryan McCue had a nice idea for his plugin Hopper: add a callback for a custom filter to return the current instance.
Sample code for the plugin:
In a theme or a second plugin you can access the instance now like this: