I am building Wordpress plugin using autoloader approach. Upon plugin activation I am trying to display a simple notice. Currently, nothing is displayed upon the activation. I would appreciate any help. I have the following 2 files:
Plugin core file:
if ( ! defined( 'ABSPATH' ) ) {
return;
}
require plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
use Acme\Class_Name;
function activator() {
Class_Name::activate();
}
register_activation_hook( __FILE__ , 'activator' );
Class File:
namespace Acme;
class Class_Name {
public static function activate() {
add_action( 'admin_notices', array( __CLASS__, 'sample_admin_notice' ) );
}
private static function sample_admin_notice() {
?>
<div class="notice notice-success is-dismissible">
<p><?php _e( 'Done!', 'sample-text-domain' ); ?></p>
</div>
<?php
}
}
Note: I configured my composer.json file and the class can be used in my core plugin file.