Smart Promotion Manager

Description

Smart Promotion Manager is a simple WordPress plugin that allows you to create and manage dynamic promo blocks on your site. Perfect for displaying promotional content, announcements, or featured items with expiration dates and custom call-to-action buttons.

Key Features

  • Custom Post Type: Easy-to-use Promo Blocks post type with WYSIWYG editor
  • Custom Fields: CTA text, CTA URL, display priority, and expiry date
  • Shortcode Support: Display promos anywhere with [dynamic_promo] shortcode
  • REST API: Access promo data via /wp-json/dcm/v1/promos endpoint
  • Smart Caching: Built-in transient caching with configurable TTL
  • AJAX Loading: Optional AJAX loading for better performance
  • Expiry Management: Automatically hide expired promos
  • Priority Ordering: Control display order with priority numbers
  • WP-CLI Support: Clear cache via wp sprom clear-cache command

Performance Features

  • Transient-based caching system
  • Conditional asset loading (CSS/JS only when needed)
  • Lazy loading images
  • Efficient database queries
  • Optional AJAX loading mode

Support

For support, feature requests, or bug reports, please contact the plugin author.

Credits

Developed by Dhrashti Patel.

Installation

  1. Upload the plugin files to the /wp-content/plugins/smart-promotion-manager directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the ‘Plugins’ screen in WordPress.
  3. Go to Settings Promo Content to configure the plugin.

FAQ

How do I create a promo block?

Go to Promo Blocks in your WordPress admin menu, click “Add New”, fill in the title, content, upload a featured image, set your CTA text and URL, choose a display priority, and optionally set an expiry date. Then publish.

How do I display promos on my site?

Use the shortcode [dynamic_promo] anywhere in your posts, pages, or widgets. The shortcode will display all active (non-expired) promo blocks ordered by priority.

Can I control how many promos are shown?

Yes, go to Settings Promo Content and set the “Maximum promo blocks” value. The shortcode will respect this limit.

How does caching work?

The plugin uses WordPress transients to cache promo queries. Set the cache duration in Settings Promo Content under “Cache time (minutes)”. Cache automatically clears when you save or update any promo block.

Can I use AJAX loading?

Yes, enable “Enable AJAX loading” in Settings Promo Content. When enabled, promos will load after the page loads via REST API, improving initial page load time.

How do I access promo data via REST API?

The plugin provides a REST endpoint at /wp-json/sprom/v1/promos that returns JSON data of all active promo blocks.

Can I clear the cache manually?

Yes, use WP-CLI command: wp sprom clear-cache or simply edit and save any promo block.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Smart Promotion Manager” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.0.0

  • Initial release
  • Custom post type for Promo Blocks
  • Shortcode support
  • REST API endpoint
  • Caching system
  • AJAX loading option
  • WP-CLI commands