A production-ready, dismissible sticky footer notification bar for WordPress announcements, alerts, and campaigns.
NotifyBar is a lightweight, highly customizable WordPress plugin that displays a beautiful sticky notification bar at the bottom of your website. Perfect for announcements, donation campaigns, alerts, or any important message.
Features:
- β Fully customizable colors and content
- β Cookie-based dismissal persistence
- β Responsive design (desktop, tablet, mobile)
- β Smooth slide-in animations
- β No jQuery dependency (vanilla JS)
- β Accessible (WCAG compliant)
- β Modern OOP architecture with PSR-4
- β WordPress Coding Standards compliant
- Announcements
- Donation drives & giving day campaigns
- Flash sales & promotions
- Event notifications
- Cookie notices
- Emergency alerts
- Special campaigns
composer install --no-dev --optimize-autoloader- Clone or download this repository
- Place the
notifybarfolder in/wp-content/plugins/ - Run
composer install --no-dev --optimize-autoloader - Activate the plugin in WordPress admin
- Activate the plugin
- Navigate to Settings β NotifyBar
- Enable the notification bar
- Customize content, colors, and cookie settings
- Save and visit your site!
- Enable/Disable - Turn the notification bar on/off
- Badge Text - Short label (e.g., "GIVING DAY")
- Title - Main heading text
- Description - Detailed message
All colors are fully customizable via WordPress color picker:
- Background color
- Badge background color
- Title text color
- Description text color
- Close button color
- Allow Dismissal - Enable/disable the close button
- Cookie Duration - How long the bar stays hidden after dismissal
- Options: 1, 7, 14, 30, 60, 365 days
notifybar/
βββ composer.json # Composer configuration
βββ notifybar.php # Main plugin file (FINAL class)
βββ src/ # Source code (PSR-4)
β βββ Plugin.php # Core plugin orchestrator
β βββ Admin/
β β βββ Settings.php # Admin settings page
β βββ Frontend/
β β βββ Bar.php # Frontend bar rendering
β βββ Assets/
β βββ Enqueue.php # Asset management
βββ assets/
β βββ css/
β β βββ notifybar.css # Frontend styles
β βββ js/
β βββ notifybar.js # Frontend JavaScript
βββ vendor/ # Composer autoloader
βββ readme.txt # WordPress.org readme
- Singleton Pattern - Main plugin class
- Dependency Injection - Component initialization
- Separation of Concerns - Admin, Frontend, Assets
- PSR-4 Autoloading - Modern PHP namespace structure
- PHP 8+ with strict typing where appropriate
- WordPress Coding Standards
- Object-Oriented Programming (OOP)
- Secure escaping and sanitization
- No global variables or functions (except entry point)
Features a FINAL class that:
- Prevents inheritance/extension
- Implements singleton pattern
- Loads Composer autoloader
- Bootstraps the plugin
- Defines constants
final class NotifyBar {
// Singleton instance
private static ?NotifyBar $instance = null;
public static function instance(): NotifyBar {
if (null === self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
}- Cookie Name:
notifybar_dismissed - Value:
1(dismissed) or not set - Duration: Admin-configurable (1-365 days)
- Scope: Site-wide, SameSite=Lax
- Purpose: Remember dismissal state
// Manually dismiss the bar
window.NotifyBar.dismiss();
// Check if dismissed
const isDismissed = window.NotifyBar.isDismissed();
// Listen to custom events
document.getElementById('notifybar').addEventListener('notifybar:dismissed', (e) => {
console.log('Bar was dismissed!');
});Developers can extend the plugin using WordPress filters and actions:
// Example: Modify settings programmatically
add_filter('option_notifybar_settings', function($settings) {
$settings['title'] = 'Custom Title';
return $settings;
});Override styles in your theme:
.notifybar {
/* Your custom styles */
}The plugin is designed to work with:
- WordPress 6.0+
- PHP 8.0+
- Modern browsers (Chrome, Firefox, Safari, Edge)
- Chrome (latest 2 versions)
- Firefox (latest 2 versions)
- Safari (latest 2 versions)
- Edge (latest 2 versions)
- Mobile browsers
- All user input is sanitized using WordPress functions
- Output is escaped properly (esc_html, esc_attr, etc.)
- Nonces used for form submissions (via Settings API)
- No SQL queries (uses WordPress Options API)
- Cookie data is non-sensitive (only stores dismiss flag)
- ARIA labels for screen readers
- Keyboard navigation support
- High contrast mode support
- Reduced motion preference support
- Semantic HTML structure
- Focus indicators on interactive elements
Breakpoints:
- Desktop: > 768px (full layout)
- Tablet: 481px - 768px (compact layout)
- Mobile: β€ 480px (stacked layout, repositioned close button)
Enable WordPress debug mode to see plugin errors:
// wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);GPL v2 or later - https://www.gnu.org/licenses/gpl-2.0.html
Md Abul Bashar
- GitHub: @hmbashar
- Plugin URL: https://github.com/hmbashar/notifybar
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch
- Follow WordPress Coding Standards
- Test your changes thoroughly
- Submit a pull request
- Initial release
- Core notification bar functionality
- Full color customization options
- Cookie-based dismissal persistence
- Responsive design for all devices
- Accessibility features
- Clean OOP architecture with PSR-4 autoloading
For issues, questions, or feature requests:
Made with β€οΈ for the WordPress community