1. Go to this page and download the library: Download yahnis-elsts/admin-notices library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yahnis-elsts / admin-notices example snippets
use \YeEasyAdminNotices\V1\AdminNotice;
AdminNotice::create()
->success('Hello world!')
->show();
AdminNotice::create()
->text('You can hide this notice by clicking the "(x)" =>')
->dismissible()
->show();
AdminNotice::create('my-notice-id')
->persistentlyDismissible(AdminNotice::DISMISS_PER_SITE)
->success('This notice can be permanently dismissed.')
->show();
AdminNotice::create('my-notice-id')
->persistentlyDismissible(AdminNotice::DISMISS_PER_SITE, WEEK_IN_SECONDS)
->success('This notice can be dismissed for 1 week.')
->show();
AdminNotice::cleanUpDatabase('myplugin-');
AdminNotice::create()
->info()
->text('This message will only appear on the "Plugins -> Installed Plugins" page')
->onPage('plugins')
->show();
add_action('admin_menu', function() {
$id = add_options_page(
'Example',
'Example',
'manage_options',
'example-admin-page',
'__return_false'
);
AdminNotice::create()
->info()
->text('This will appear on "Settings -> Example"')
->onPage($id)
->show();
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.