1. Go to this page and download the library: Download stellarwp/banners 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/ */
stellarwp / banners example snippets
use StraussGeneratedNamespace\Nexcess\Banners\Banner;
use StraussGeneratedNamespace\Nexcess\Banners\BannerFields;
use StraussGeneratedNamespace\Nexcess\Banners\Registry;
add_action(
'init',
static function (): void {
$fields = new BannerFields();
$fields->heading = __( 'Black Friday: 40% off Pro.', 'my-plugin' );
$fields->body = __( 'Unlock every block and priority support.', 'my-plugin' );
$fields->ctaLabel = __( 'Shop the sale', 'my-plugin' );
$fields->ctaUrl = 'https://example.com/black-friday?utm_source=my-plugin';
( new Registry() )->register(
new Banner(
'nexcess-black-friday-2026',
'1.0.0',
$fields,
plugins_url( 'vendor-prefixed/stellarwp/banners/', MY_PLUGIN_FILE ),
new DateTimeImmutable( '2026-11-27 00:00', new DateTimeZone( 'America/New_York' ) ),
new DateTimeImmutable( '2026-12-01 00:00', new DateTimeZone( 'America/New_York' ) )
)
);
}
);