-
Notifications
You must be signed in to change notification settings - Fork 121
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.
- Refer to the Breaking Changes page and review your plugin for any updates that need to happen.
- Add a WordPress plugin header block to the top of your plugin file.
- If you used the
GP_Plugin
class to base your plugin on, remove it as it no longer exists. - Any
add_action()
oradd_filters()
calls you have must be converted to the WordPressadd_action()
/add_filter()
format. - 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. - 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). - Replace your initialization of the plugin with an
add_action( 'gp_init', 'gp_plugin_slug_name_or_whatever' )
call. - Create a readme.txt file.