Skip to content

Instantly share code, notes, and snippets.

@DevinWalker
Last active October 10, 2015 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DevinWalker/28e177ae71b55d9f5d84 to your computer and use it in GitHub Desktop.
Save DevinWalker/28e177ae71b55d9f5d84 to your computer and use it in GitHub Desktop.
To use the banner class built into Give's core use the following
<?php
/**
* Give NAME OF ADD-ON Activation Banner
*
* @description: Includes and initializes the activation banner class; only runs in WP admin
* @hook admin_init
*/
function give_myaddon_activation_banner() {
if ( ! class_exists( 'Give_Addon_Activation_Banner' ) && file_exists( GIVE_PLUGIN_DIR . 'includes/admin/class-addon-activation-banner.php' ) ) {
include GIVE_PLUGIN_DIR . 'includes/admin/class-addon-activation-banner.php';
}
if ( ! class_exists( 'Give_Addon_Activation_Banner' ) {
//bail if class & file not found
return false;
}
//Only runs on admin
$args = array(
'file' => __FILE__,
//Directory path to the main plugin file
'name' => __( 'Myaddon Payment Gateway', 'give-stripe' ),
//name of the Add-on
'version' => GIVE_myaddon_VERSION,
//The most current version
'documentation_url' => 'https://givewp.com/documentation/add-ons/myaddon-gateway/',
'support_url' => 'https://givewp.com/support/forum/add-ons/myaddon-gateway/',
'settings_url' => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ),
//Location of Add-on settings page, leave blank to hide
'testing' => false,
//Never leave as "true" in production!!!
);
new Give_Addon_Activation_Banner( $args );
return false;
}
add_action( 'admin_init', 'give_myaddon_activation_banner' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment