=== Exit-Intent Popup === Contributors: ammarsaif Tags: exit-intent, popup, discount, WooCommerce, conversion, lead generation Requires at least: 5.0 Tested up to: 6.7 Requires PHP: 7.2 Stable tag: 1.1.1 License: GPL-2.0+ License URI: https://www.gnu.org/licenses/gpl-2.0.html A powerful exit-intent popup plugin with a professional admin UI and advanced Display Rules that help retain visitors and boost conversions. == Description == **Exit-Intent Popup** detects when a visitor is about to leave your site and displays a fully customisable popup offering a discount code, a message, or a call-to-action button to encourage them to stay and convert. The plugin ships with a modern, card-based admin interface and powerful targeting options — all without writing a single line of code. === Key Highlights === * Clean, professional admin UI with gradient header, icon tabs, card layouts and live previews * Full typography control — system fonts and Google Fonts for title, body, and CTA button * Advanced Display Rules — target by page, user login status, frequency, and device type * Frequency control via browser localStorage (always / per session / daily / weekly / once ever) * Device targeting — show on all devices, desktop only, or mobile only * Exit-intent detection with configurable delay and five animation effects * Live button and design previews that update in real time as you type == Features == === Popup Behaviour === * Enable / disable popup globally with a toggle switch * Configurable delay (seconds) before the popup can trigger * Five entry animations: Fade In, Slide Down, Zoom In, Bounce, None * Three popup positions: Top, Center, Bottom * Adjustable overlay opacity (0–1) * Optional close (×) button * ESC key closes the popup === Design & Appearance === * Background color picker (HEX / RGB) * Background image upload via WordPress Media Library * Text color and discount code color pickers * Live popup preview that updates as you change colors and images === Typography === * Separate font controls for title and content text * System fonts: Arial, Verdana, Helvetica, Georgia, and more * Google Fonts integration with autocomplete search and popular-fonts shortlist * Font weight control (Normal / Bold / Lighter / Bolder) * Live font preview boxes === Content === * Rich text editor (wp_editor) for the popup message — supports HTML and shortcodes * Customisable promo / discount code with inline preview * Toggle to show or hide the discount code block === CTA Button === * Enable / disable the call-to-action button * Button text, URL, and link target (same tab / new tab) * Background color, text color, font size, and padding * System or Google Font selection for the button label * Border radius, border width, and border color * Live button preview that updates in real time === Display Rules (New in 1.1.0) === * **Page Targeting** — show on all pages, front page only, blog/posts only, or specific pages/posts you select * **Audience Targeting** — show to everyone, guests only (logged-out), or members only (logged-in) * **Frequency Control** — always, once per session, once per day, once per week, or once ever (tracked via localStorage) * **Device Targeting** — all devices, desktop only (≥ 768 px), or mobile only (< 768 px) === Admin Interface (New in 1.1.0) === * Full-width, responsive layout that adapts to any screen size * Gradient header banner with version badge and live Active/Inactive status * Six icon tabs: General, Design, Typography, Content, CTA Button, Display Rules * Card-based section layout with icons and descriptive sub-headings * Animated toggle switches replace plain checkboxes * Visual option cards replace plain radio buttons for Position, Animation, Audience, Frequency, and Device * Quick Status sidebar widget showing live values from the database * Pro Tips sidebar with conversion best practices * View Site shortcut link from within the settings page == Installation == 1. Download the plugin ZIP or install directly from the WordPress Plugin Directory. 2. Upload the plugin folder to `/wp-content/plugins/` if installing manually. 3. Activate the plugin via the **Plugins** menu in WordPress. 4. Navigate to **Exit-Intent Popup** in the WordPress admin sidebar to configure. == Usage == 1. **General tab** — Enable the popup, configure delay, animation, position, and overlay opacity. 2. **Design tab** — Pick colors and an optional background image. Preview updates live. 3. **Typography tab** — Choose system or Google Fonts for the title and body text. 4. **Content tab** — Write your popup message in the rich-text editor and set the promo code. 5. **CTA Button tab** — Configure the call-to-action button label, URL, colors, and live-preview it. 6. **Display Rules tab** — Set page targeting, audience, frequency, and device rules. 7. Click **Save Settings** — your popup is live immediately. == Screenshots == 1. **General Tab** — Popup Status, Trigger Settings, and Display Options with visual option cards. 2. **Design Tab** — Color pickers, background image upload, and live popup preview. 3. **Typography Tab** — System and Google Font selectors with live preview boxes. 4. **Content Tab** — Rich text editor, discount code toggle, and inline preview. 5. **CTA Button Tab** — Full button customisation with real-time preview. 6. **Display Rules Tab** — Page targeting, audience, frequency, and device controls. 7. **Sidebar** — Quick Status widget and Pro Tips panel. == Frequently Asked Questions == = How do I disable the popup? = Go to **Exit-Intent Popup > General** and toggle the **Enable Popup** switch off. = Can I show the popup only on specific pages? = Yes. Go to the **Display Rules** tab, choose **Specific Pages**, and select from the list of your published pages and posts. = How do I stop the popup from annoying repeat visitors? = Use the **Display Frequency** setting in the **Display Rules** tab. "Once per session" or "Once per day" are recommended for most sites. = Can I show the popup only on mobile? = Yes — set **Device Targeting** to **Mobile Only** in the **Display Rules** tab. = Can I show the popup only to logged-out visitors? = Yes — set **Audience Targeting** to **Guests Only** in the **Display Rules** tab. = Can I use a background image instead of a color? = Yes. Upload an image via the **Design** tab. The image overrides the background color. = Does the popup work on mobile? = Yes. Exit-intent detection (mouse leaving the viewport) is desktop-centric, but you can still show the popup on mobile after a configured delay. = Can I use Google Fonts? = Yes. In the **Typography** and **CTA Button** tabs, switch to **Google Font**, type a font name, and choose from the autocomplete suggestions. = Is the plugin secure? = All settings are sanitized on save using WordPress functions (`sanitize_text_field`, `sanitize_hex_color`, `esc_url_raw`, etc.) and escaped on output. == Changelog == = 1.1.1 = **Bug Fix** * `uninstall.php` was missing six options introduced in 1.1.0 — `exitpo_show_discount` and all five Display Rules settings (`exitpo_show_on`, `exitpo_specific_pages`, `exitpo_show_to`, `exitpo_frequency`, `exitpo_device_target`) — these are now properly deleted when the plugin is uninstalled, leaving no orphaned rows in `wp_options` = 1.1.0 = **New Feature: Display Rules** * Page targeting — all pages, front page, blog/posts, or specific pages/posts * Audience targeting — everyone, guests only, or members only (logged-in) * Frequency control — always / once per session / once per day / once per week / once ever (localStorage) * Device targeting — all devices / desktop only / mobile only **Admin UI Overhaul** * Full-width, screen-adaptive layout — no more wasted blank space * New gradient header banner with version badge and live status indicator * Six icon-based navigation tabs (General, Design, Typography, Content, CTA Button, Display Rules) * All tab content migrated from plain form tables to card-based sections * Animated CSS toggle switches replace checkboxes for boolean settings * Visual icon+label option cards replace radio buttons for positional/animation/rule selectors * Quick Status sidebar widget showing live setting values * Pro Tips sidebar panel with conversion best-practice hints * View Site shortcut button in the sidebar * Full-width responsive layout via a dedicated `admin.css` stylesheet (replaces scattered inline styles) **Frontend Improvements** * Animation engine updated to properly implement all five effects (fadeIn, slideDown, zoomIn, bounce, none) * Popup position (top / center / bottom) now applied dynamically by JavaScript * Overlay opacity is now applied as a CSS custom property from the saved setting * ESC key support to close the popup * Frequency check uses `sessionStorage` (per session) or `localStorage` with timestamps (daily/weekly/once) * Device check compares `window.innerWidth` against 768 px breakpoint before showing popup * `animation`, `position`, `frequency`, and `device_target` now passed to frontend via `wp_localize_script` **Bug Fixes** * `exitpo_show_discount` was registered but never saved — now properly registered and enforced * Background overlay opacity was hardcoded in CSS — now reads the saved option value * CTA toggle in settings panel now uses JavaScript card visibility instead of class toggling on `` elements * **Critical** — saving settings on any tab was wiping all other tabs' settings; fixed with a two-level hidden-field strategy: `exitpo_hidden_fallback_fields()` emits every setting's current DB value before the tab content so WordPress `options.php` always receives a value for every registered option; per-tab `value="0"` sentinels placed before each checkbox handle the "unchecked on current tab" case without affecting other tabs * **Critical** — toggle switches (Enable Popup, Close Button, Show Discount, Enable CTA) were being turned off when saving from a different tab because the global checkbox fallback incorrectly used `value="0"` instead of the current saved value; corrected so the global fallback preserves the DB state and only the per-tab sentinel can flip a checkbox to off * Admin page layout made fully responsive and full-width — removed fixed `max-width: 1180px` cap so the settings page uses all available screen space * Proper left/right padding added to the settings wrapper so content does not touch screen edges * Plugin version number is now read dynamically from the file header via `EXITPO_VERSION` constant (using `get_file_data()`) — eliminates the hardcoded version string that required manual updates in multiple places = 1.0.2 = * Added CTA button with extensive customisation options * Added Google Fonts integration for all text elements * Added font weight controls for headings and content * Added border customisation for CTA button * Added separate typography settings for content and headings * Improved admin UI with tabbed interface * Enhanced font preview functionality * Added popular fonts quick selection * Added option to open CTA link in new tab * Added more sanitisation and security checks * Performance optimisations for font loading * Code refactoring and organisation improvements = 1.0.1 = * Bug fixes and prefixing changes. = 1.0 = * Initial release with full customisation options. == Upgrade Notice == = 1.1.1 = Minor maintenance release: fixes uninstall cleanup — six options added in 1.1.0 were not deleted on uninstall, leaving orphaned rows in `wp_options`. No functional changes. = 1.1.0 = Major update: new Display Rules feature (page, audience, frequency, and device targeting) plus a complete admin UI overhaul. Includes critical bug fixes — saving on one tab no longer wipes settings saved on other tabs, and toggle switches now preserve their state correctly across all tabs. Fully backwards-compatible — all existing settings are preserved. == License == This plugin is licensed under the **GPL-2.0+** license. See https://www.gnu.org/licenses/gpl-2.0.html for details. == Support == For support, feature requests, or bug reports, please visit the WordPress support forum or contact the plugin author.