WP Manifestindependent plugin directory
manifest / content / wp-stickybar

WP StickyBar

WordPress sticky bar plugin

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/nadimtuhin/wp-stickybar/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

WP StickyBar Plugin

A professional WordPress plugin for displaying important announcements, emergency alerts, holiday messages, and events with comprehensive analytics tracking and extensive hooks for developers.

Author: Nadim Tuhin
Email: nadimtuhin@gmail.com
GitHub: https://github.com/nadimtuhin/wp-stickybar
Version: 1.0.0

Features

  • 7 Professional Preset Types: Emergency, Important, Holiday/Event, Information, Success, Warning, Generic
  • Real-time Analytics: Track views and clicks with detailed dashboard and metrics
  • Advanced Scheduling: Set start/end dates with automatic activation/deactivation
  • Responsive Design: Mobile-friendly with customizable dismiss functionality
  • Extensive Hooks: 40+ action and filter hooks for maximum extensibility
  • WordPress AJAX: Proper implementation using wp_ajax hooks with nonce verification
  • Security First: Comprehensive data validation, sanitization, and rate limiting
  • Developer Friendly: Extensive documentation and clean, extensible code

Preset Design Types

1. Emergency 🚨

  • Red background (#dc3545)
  • Non-dismissible
  • Pulse animation
  • Top position priority

2. Important ⚡

  • Orange background (#fd7e14)
  • Session dismissible
  • Bounce animation

3. Holiday/Event 🎉

  • Purple background (#6f42c1)
  • Dismissible
  • Seasonal icons

4. Information ℹ️

  • Cyan background (#0dcaf0)
  • Bottom position
  • Clean design

5. Success ✅

  • Green background (#198754)
  • Slide down animation

6. Warning ⚠️

  • Yellow background (#ffc107)
  • High visibility

7. Generic 📢

  • Gray background (#6c757d)
  • Fully configurable

Database Schema

stickybars table

  • id (primary key)
  • title (varchar 255)
  • message (text)
  • link_url (varchar 500)
  • link_text (varchar 100)
  • preset_type (varchar 20)
  • custom_styles (text)
  • start_date (datetime)
  • end_date (datetime)
  • is_active (boolean)
  • position (enum: top, bottom)
  • is_dismissible (boolean)
  • created_at (timestamp)
  • updated_at (timestamp)

stickybar_analytics table

  • id (primary key)
  • stickybar_id (foreign key)
  • event_type (enum: view, click)
  • user_ip (varchar 45)
  • page_url (varchar 500)
  • user_agent (text)
  • timestamp (datetime)

File Structure

wp-stickybar/
├── wp-stickybar.php (main plugin file)
├── README.md (this file)
├── includes/
│   ├── class-database.php (database operations)
│   ├── class-stickybar.php (core functionality)
│   ├── class-admin.php (admin interface)
│   ├── class-analytics.php (tracking system)
│   └── class-presets.php (design presets)
├── admin/
│   ├── admin-page.php (main admin page)
│   ├── analytics-page.php (analytics dashboard)
│   └── settings-page.php (plugin settings)
├── assets/
│   ├── css/
│   │   ├── frontend.css (frontend styles)
│   │   └── admin.css (admin styles)
│   └── js/
│       ├── frontend.js (frontend functionality)
│       └── admin.js (admin functionality)
└── uninstall.php (cleanup on uninstall)

Installation

  1. Upload the plugin files to /wp-content/plugins/wp-stickybar/
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Go to 'StickyBar' in the admin menu to create your first announcement

Usage

  1. Create Announcement: Go to StickyBar > Add New
  2. Choose Preset: Select from 7 predefined styles or customize
  3. Set Schedule: Optional start/end dates
  4. Configure Options: Position, dismissible settings
  5. View Analytics: Track performance in Analytics tab

Security Features

  • Nonce verification for all forms
  • Data sanitization and validation
  • Capability checks for admin access
  • SQL injection prevention
  • XSS protection

Developer Extensibility

Extensive Hook System

WP StickyBar provides 40+ action and filter hooks for maximum extensibility. All hooks follow WordPress standards with proper nonce verification and capability checks.

Key Action Hooks

  • wp_stickybar_init - Plugin initialization
  • wp_stickybar_before_display / wp_stickybar_after_display - Display lifecycle
  • wp_stickybar_before_save / wp_stickybar_after_save - Data operations
  • wp_stickybar_before_track / wp_stickybar_after_track - Analytics events
  • wp_stickybar_activated / wp_stickybar_deactivated - Plugin lifecycle

Key Filter Hooks

  • wp_stickybar_message - Modify message content
  • wp_stickybar_displayable_bars - Filter which bars to display
  • wp_stickybar_should_display - Custom display conditions
  • wp_stickybar_classes - Add custom CSS classes
  • wp_stickybar_script_data - Modify frontend script data

WordPress AJAX Implementation

All AJAX functionality uses proper WordPress standards:

  • wp_ajax_ and wp_ajax_nopriv_ hooks
  • Nonce verification for security
  • Capability checks for permissions
  • Rate limiting to prevent abuse
  • Comprehensive error handling

Full Documentation

Complete hooks documentation available in HOOKS.md with:

  • Detailed parameter descriptions
  • Usage examples for each hook
  • Security considerations
  • AJAX endpoint documentation

Example Extensions

Add Custom CSS Class to Emergency Bars

add_filter('wp_stickybar_classes', 'add_emergency_class', 10, 2);
function add_emergency_class($classes, $stickybar) {
    if ($stickybar->preset_type === 'emergency') {
        $classes[] = 'my-custom-emergency';
    }
    return $classes;
}

Custom Analytics Integration

add_action('wp_stickybar_after_track', 'send_to_analytics', 10, 3);
function send_to_analytics($stickybar_id, $event_type, $data) {
    // Send to your analytics service
}

Modify Display Conditions

add_filter('wp_stickybar_should_display', 'custom_display_rules', 10, 2);
function custom_display_rules($should_display, $stickybar) {
    // Your custom logic
    return $should_display;
}

Requirements

  • WordPress 5.0+
  • PHP 7.4+
  • MySQL 5.6+

Installation & Testing

The plugin includes a built-in test suite available in debug mode:

  1. Set WP_DEBUG to true in wp-config.php
  2. Navigate to StickyBar → Tests in admin
  3. Run comprehensive plugin tests

Support & Contributing

License

GPL v2 or later


Built with ❤️ for the WordPress community by Nadim Tuhin