I am using the WP Plugin Boilerplate and I am requiring files and admin notices within the activator class but my Kirki panel is not showing up in the customizer and the admin notice isn't appearing. I am also not getting any error messages.
Also PLUGINPATH
is set to plugin_dir_path( __FILE__ )
.
class Wp_Portfolio_Pro_Activator {
/**
* Short Description. (use period)
*
* Long Description.
*
* @since 1.0.0
*/
public static function activate() {
// Require Kirki and setting for plugin build on framework.
self::load_files();
add_action( 'admin_notices', array( __CLASS__, 'admin_notice' ) );
}
public static function admin_notice() {
$message = '<div class="notice notice-success"><p>';
$message .= sprintf( __( 'Hello %s!', 'my-plugin' ), '<strong>' . get_current_user_name() . '</strong>' );
$message .= '</p><p>';
$message .= __( 'Thank you for downloading WP Portfolio Pro. Edit the setting from the customizer.', 'wp-portfolio-pro' );
$message .= '</p>';
$message .= '<a href="' . esc_url( admin_url( 'customize.php?customize_changeset_uuid=' . get_theme_mods_changeset_post_id() ) ) . '"><button>Go to settings</button></a></div>';
echo $message;
printf( '<div class="notice notice-success is-dismissible">%1$s</div>', $message );
}
public static function load_files() {
// Require Kirki and setting for plugin build on framework.
require_once PLUGINPATH . 'includes/kirki/kirki.php';
require_once PLUGINPATH . 'includes/wp-portfolio-pro-kirki.php';
}
}
This is the code in the main file that hooks into the activation hook.
/**
* The code that runs during plugin activation.
* This action is documented in includes/class-wp-portfolio-pro-activator.php
*/
function activate_wp_portfolio_pro() {
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-portfolio-pro-activator.php';
Wp_Portfolio_Pro_Activator::activate();
}
/**
* The code that runs during plugin deactivation.
* This action is documented in includes/class-wp-portfolio-pro-deactivator.php
*/
function deactivate_wp_portfolio_pro() {
require_once PLUGINPATH . 'includes/class-wp-portfolio-pro-deactivator.php';
Wp_Portfolio_Pro_Deactivator::deactivate();
}
register_activation_hook( __FILE__, 'activate_wp_portfolio_pro' );
register_deactivation_hook( __FILE__, 'deactivate_wp_portfolio_pro' );