
Ad Rotator & Sticky Footer – Weighted Random Ads with Sticky Footer Display for WordPress
Manage multiple ads with weighted rotation. Display ads via shortcode, widget, or sticky footer that slides to the bottom on scroll.
Ad Rotator & Sticky Footer plugin Feature List
Features
- Weighted Random Rotation — Assign each ad a weight (1-10). An ad with weight 8 appears roughly twice as often as an ad with weight 4. The system builds a weighted pool and picks randomly.
- Sticky Footer Mode — Use
[rw_ad mode="sticky-footer"]to make ads slide to the screen bottom after the visitor scrolls past 60% of the page. Scroll back up and the ad returns to its original inline position. - 24-Hour Dismissal — Each sticky ad includes a close button. Clicking it hides the sticky behavior for 24 hours using browser localStorage.
- WordPress Widget — Use the “Random Ad — Ad Rotator” widget in any sidebar. Leave the title blank for a clean, title-free display.
- Simple Admin Panel — Tab-based settings page under Settings → Ad Rotator. Add, edit, delete, and toggle ads. Each ad shows its weight, status, and content preview in the list.
- Zero Performance Impact — All JavaScript is inline and only loaded when the sticky footer shortcode is present. The inline script is approximately 1KB. No external dependencies.
- Shortcode Driven — Place
[rw_ad]anywhere: posts, pages, GP Elements, or theme templates. No settings required on the frontend. - i18n Ready — Full translation support with POT file included. Text Domain:
ad-rotator-sticky-footer.
Usage Instructions
Requirements
- WordPress 5.8 or higher
- PHP 7.4 or higher
Installation
- Upload the
ad-rotator-sticky-footerfolder to/wp-content/plugins/. - Activate the plugin through the Plugins screen in WordPress.
- Go to Settings → Ad Rotator to add your first ad.
- Place the
[rw_ad]shortcode in any post, page, or GP Element.
Configuration
- Add an Ad — Go to Settings → Ad Rotator. Fill in the Title (internal reference), Ad HTML (any HTML, shortcodes, or text), Weight (1-10), and check Active. Click Add Ad.
- Use the Shortcode — Place
[rw_ad]in any page, post, or GP Element to display a randomly selected active ad. Each page load picks a different ad using weighted probability. - Sticky Footer (Optional) — Use
[rw_ad mode="sticky-footer"]instead. The ad shows inline initially, then slides to the screen bottom after the visitor scrolls past 60% of the page. Scrolling back up returns it to its original position. - Use the Widget — Go to Appearance → Widgets and drag the Random Ad — Ad Rotator widget to any sidebar.
- Deactivate an Ad — Uncheck Active on any ad to temporarily exclude it from rotation without deleting it.
Display Conditions
The shortcode works anywhere WordPress processes shortcodes — posts, pages, widgets, and GP Elements. For targeted display, use GeneratePress Premium’s Display Rules inside a GP Element, or use standard WordPress conditional tags in your theme templates.
Frequently Asked Questions
Q: Does this plugin load any external scripts?
A: No. All JavaScript is inline and only loaded when the [ shortcode with [rw_ad]]mode="sticky-footer" is present on the page. The inline script is approximately 1KB.
Q: How does the weight system work?
A: Each ad gets a weight value (1-10). Behind the scenes, the plugin builds a weighted pool where an ad with weight 8 appears 8 times in the pool while a weight-4 ad appears 4 times. It then picks randomly from this pool — so weight 8 shows roughly twice as often as weight 4.
Q: Can I use this with caching plugins?
A: Yes. The random selection happens server-side on each request via WP_Options API, so page caching does not affect ad rotation. Each page load selects a fresh random ad.
Q: Does the sticky footer interfere with page content?
A: No. When the ad becomes sticky, the plugin appends padding-bottom to the <body> to prevent content from being hidden behind the ad. The ad is also moved to the end of <body> when sticky to avoid stacking context issues with other page elements.
Q: What happens if I delete all ads?
A: The shortcode and widget simply output nothing. No error messages are shown to visitors. The admin panel shows a “No ads yet” message with a prompt to add the first ad.
Q: Can I add multiple ads and have them rotate on the same page?
A: Yes. You can add unlimited ads with different weights. Each call to [rw_ad independently selects one random ad from the active pool. Use the shortcode multiple times on the same page to show different ads in different positions.]
Q: What happens when I deactivate or uninstall the plugin?
A: Deactivating stops shortcode processing — [ will appear as plain text. Uninstalling via the Plugins screen runs [rw_ad]]uninstall.php, which removes all stored ads from the wp_options table.
Q: Can I use HTML in the ad content?
A: Yes. The Ad HTML field accepts any valid HTML, inline CSS, and WordPress shortcodes. Content is sanitized via wp_kses_post() before storage, so safe HTML tags are preserved while potentially dangerous elements are stripped.
How It Works
1. Add Your Ads
Go to Settings → Ad Rotator and add your first ad. Give it a title, enter your HTML content (banner code, affiliate link, shortcode), set a weight, and mark it active. Add as many ads as you need.
2. Place the Shortcode
Use [ anywhere you want a random ad to appear — in a post, a page, a GP Element, or a widget area. For sticky footer behavior, use [rw_ad][ instead.[rw_ad mode="sticky-footer"]]
3. Weighted Rotation Runs Automatically
Each page load independently picks one ad from the active pool using weighted probability. Ads with higher weights appear more frequently. No configuration needed — it just works.
Requirements & Compatibility
- WordPress 5.8+ | PHP 7.4+
- No external dependencies or third-party services
- Works with all WordPress themes
- Compatible with GeneratePress, Kadence, Astra, and all block themes
- Works with all caching plugins (WP Rocket, W3 Total Cache, LiteSpeed Cache, etc.)
- GDPR-friendly — no cookies, no tracking, no external requests
- Tested up to WordPress 6.8
Use Cases & Long-Tail Keywords
This plugin fits many advertising and monetization scenarios:
- Affiliate ad rotation WordPress plugin — Rotate affiliate banners with weighted display. Give premium partners higher weights.
- Sticky footer ad bar WordPress — Non-intrusive ad bar that slides in at the bottom, similar to mobile app install banners.
- Random ad display widget WordPress — Sidebar widget that shows different ads each page load without any page builder dependency.
- WordPress ad rotator with weighted probability — More control than simple random shuffle. Weight 10 = 10× more likely than weight 1.
- Lightweight WordPress ad manager without tracking — Zero cookies, zero external scripts, GDPR-compliant out of the box.
- GeneratePress ads shortcode — Works natively inside GP Elements with Display Rules for targeted ad placement.