1.2 Converting Plugins

Sergey Biryukov edited this page Jan 24, 2016 · 5 revisions

GlotPress as a Plugin does not use the same code for plugins as the standalone version of GlotPress does, instead it uses the WordPress plugin infrastructure.

If you have a GlotPress plugin for the standalone version converting it is relatively straight forward.

  1. Refer to the Breaking Changes page and review your plugin for any updates that need to happen.
  2. Add a WordPress plugin header block to the top of your plugin file.
  3. If you used the GP_Plugin class to base your plugin on, remove it as it no longer exists.
  4. Any add_action() or add_filters() calls you have must be converted to the WordPress add_action()/add_filter() format.
  5. If you're using a define() to enable/disable your plugin, remove it, using the activate/deactivate functionality in WordPress's plugin system is the way to go.
  6. If you're using warnings/errors from the GP_Plugin class, replace them with the appropriate gp_notice_set() call ( gp_notice_set( $string ) for warnings, gp_notice_set( $string, 'error' ) for errors).
  7. Replace your initialization of the plugin with an add_action( 'gp_init', 'gp_plugin_slug_name_or_whatever' ) call.
  8. Create a readme.txt file.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.