-
Notifications
You must be signed in to change notification settings - Fork 142
How to write an add on for LearnPress
Pierre Rudloff edited this page Mar 21, 2018
·
4 revisions
You can easily write an add-on for LearnPress. All you need is an idea and completing a few steps for your add-on to work with LearnPress. Here they are:
learn_press_addon_register( $slug, $args )
This function registers your add on to LearnPress, so it can appear in LearnPress add-on list and when users enable your add-on, it will run accordingly.
- $slug (string)(required)The slug name for you add-on
- $args (array)(required) The array represent the elements that provide information about your add-on Default: none
$addon = array(
'name' => [ <string> ], // The name of the add-on.
'description' => [ <string> ], // The descriptiong of the add-on.
'author' => [ <string> ], // The name of the aurthor of the add-on.
'author_url' => [ <string> ], // The url of the author.
'file' => [ <string> ], // The address of the main file of the add-on.
'category' => [ <string> ], // The add-on category (categorize add-ons).
'tag' => [ <string> ], // Add-on tags.
'settings-callback' => [ <string> ], // (optional) If your add-on need to setting, this is the add-on setting file address.
);
$addon = array(
'name' => __( 'Certificate', 'learn_press' ),
'description' => __( 'Allow create a certificate for student after they finish a course', 'learn_press' ),
'author' => 'foobla',
'author_url' => 'http://thimpress.com',
'file' => LPR_CERTIFICATE_PATH . '/incs/load.php',
'category' => 'courses',
'tag' => 'core',
'settings-callback' => '',
);
learn_press_addon_register( 'lpr-certificate-add-on', $addon );