Add-ons to Existing WordPress Plugins

All plugins distributed for WordPress are supposed to be licensed under the GPL as open source. Therefore, if you see a plugin that does almost everything you want and requires just a little tweaking, it is possible to make what’s called an add-on. This is done via hooks and filters in a well designed, extensible plugin or you can just hack in directly. The former is recommended of course when possible.

A few other parts of the whole core code and plugin universe is the discussed.

  • The WordPress loop is php code which loops through posts and displays them in template php pages
  • WordPress Global Variables (you can see the entire list on the WordPress codex site) such as $post (data from the current post you are working on)
  • $wpdb is the class used to access the database directly. For traditional php programmers this is equivalent to $mysql. This object is especially useful for custom tables in a plugin but WordPress built-in functions should be used whenever possible for core data.
    • query() is the function that takes SQL commands and runs them on the db.
    • SQL commands have specific formatting rules (p.70)
    • an xxx_db_Setup function should be created to run at init to initialize any database tables needed.
    • there are a number of commonly used variables like rows_affected on $wpdb that are useful – see the WordPress codex for a listing of all

Categories: WordPress