WP Manifestindependent plugin directory
manifest / content / smart-text-modal-manager

Smart Text Modal Manager

Create, manage, schedule, and display smart text modals in WordPress with audience targeting, device targeting, session limits, auto-close, and basic interaction statistics.

by Amirreza Shayesteh Far · github.com/amirrezashf/smart-text-modal-manager

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/amirrezashf/smart-text-modal-manager/archive/refs/heads/main.zip

Readme

Smart Text Modal Manager

A lightweight WordPress plugin for creating, managing, scheduling, and displaying smart text modals on the frontend.

Description

Smart Text Modal Manager adds a custom admin page for managing text-based modals in WordPress.

The plugin allows administrators to create multiple modals, configure display rules, select one active modal, track basic modal statistics, and show the active modal on eligible frontend pages.

It is designed as a single-file WordPress plugin with no external dependencies.

Features

  • Create and manage multiple text modals
  • Select one active modal
  • Custom modal content editor
  • Optional first and second action buttons
  • Button URL and new-tab options
  • Display delay after page load
  • Audience targeting:
    • All users
    • Logged-in users
    • Logged-out users
  • Device targeting:
    • Desktop
    • Tablet
    • Mobile
    • Combined device groups
  • Session-based display limit
  • Date-based scheduling
  • Daily hour-based scheduling
  • Optional auto-close timer
  • Font size and color controls
  • Basic statistics:
    • Impressions
    • Close count
    • First button clicks
    • Second button clicks
  • Avoids displaying modals on sensitive paths
  • AJAX event tracking
  • No external libraries required

Requirements

  • PHP 7.4+
  • WordPress 6.0+

Installation

  1. Create a folder named smart-text-modal-manager.
  2. Place the plugin file inside it.
  3. Make sure the main plugin file is named:
main.php
  1. Upload the folder to:
wp-content/plugins/
  1. Activate the plugin from the WordPress admin panel.
  2. Open the “Text Modal” admin menu.

Usage / How it Works

  1. Go to the plugin admin page.
  2. Create a new text modal.
  3. Add modal content.
  4. Configure display delay, audience, device targeting, schedule, and buttons.
  5. Save the modal.
  6. Set the modal as active.

Only the active published modal is displayed on the frontend.

The modal will not be displayed when:

  • No modal is active
  • The active modal is not published
  • The current user does not match the selected audience
  • The current device does not match the selected device target
  • The current date/time is outside the configured schedule
  • The current path is considered sensitive
  • The session display limit has already been reached

Data Storage

The plugin stores modal data as a hidden custom post type.

Modal settings are stored as post meta, including:

  • Modal content
  • Delay settings
  • Button settings
  • Audience targeting
  • Device targeting
  • Schedule settings
  • Auto-close settings
  • Font settings
  • Statistics counters

The active modal ID is stored as a WordPress option.

Development

Built with:

  • WordPress Coding Standards
  • Native WordPress APIs
  • Custom Post Types
  • Post Meta
  • Options API
  • AJAX API
  • Admin Menu API
  • WordPress editor
  • Sanitized inputs
  • Escaped outputs
  • Lightweight frontend rendering
  • Single-file architecture

Hooks

The plugin uses WordPress hooks including:

  • init
  • admin_menu
  • admin_init
  • wp_footer
  • wp_ajax_fa_tm_track_event
  • wp_ajax_nopriv_fa_tm_track_event
  • before_delete_post
  • trashed_post

Security

The plugin includes:

  • Direct access protection
  • Admin-only management page
  • Nonce verification for admin actions
  • Input sanitization
  • Output escaping
  • Restricted modal management access
  • Safe redirects after admin actions

Future Improvements

  • Export/import modal settings
  • Admin settings page
  • Reset statistics button
  • More placement options

License

GPL-2.0-or-later

Author

Amirreza Shayesteh Far

GitHub: https://github.com/amirrezashf


مدیریت هوشمند مودال متنی

یک افزونه سبک وردپرس برای ساخت، مدیریت، زمان‌بندی و نمایش مودال‌های متنی در فرانت‌اند سایت.

توضیحات

افزونه Smart Text Modal Manager یک صفحه مدیریتی اختصاصی برای مدیریت مودال‌های متنی در وردپرس اضافه می‌کند.

با این افزونه می‌توان چند مودال ساخت، قوانین نمایش را تنظیم کرد، یک مودال فعال انتخاب کرد، آمار پایه را مشاهده کرد و مودال فعال را در صفحات مجاز فرانت‌اند نمایش داد.

این افزونه تک‌فایلی است و وابستگی خارجی ندارد.

ویژگی‌ها

  • ساخت و مدیریت چند مودال متنی
  • انتخاب یک مودال فعال
  • ویرایشگر محتوای مودال
  • امکان تعریف دکمه اول و دوم
  • تنظیم لینک دکمه‌ها
  • امکان باز شدن لینک‌ها در تب جدید
  • تنظیم تأخیر نمایش بعد از بارگذاری صفحه
  • هدف‌گیری مخاطب:
    • همه کاربران
    • کاربران واردشده
    • کاربران واردنشده
  • هدف‌گیری دستگاه:
    • دسکتاپ
    • تبلت
    • موبایل
    • ترکیب چند دستگاه
  • محدودیت نمایش در هر سشن
  • زمان‌بندی بر اساس تاریخ
  • زمان‌بندی بر اساس ساعت روزانه
  • بستن خودکار مودال
  • تنظیم سایز و رنگ فونت
  • آمار پایه:
    • تعداد نمایش
    • تعداد بستن
    • کلیک دکمه اول
    • کلیک دکمه دوم
  • عدم نمایش در مسیرهای حساس
  • ثبت رویدادها با AJAX
  • بدون کتابخانه خارجی

نیازمندی‌ها

  • PHP 7.4+
  • WordPress 6.0+

نصب

  1. یک پوشه با نام smart-text-modal-manager بسازید.
  2. فایل افزونه را داخل آن قرار دهید.
  3. مطمئن شوید نام فایل اصلی افزونه این باشد:
main.php
  1. پوشه را در مسیر زیر آپلود کنید:
wp-content/plugins/
  1. افزونه را از پنل مدیریت وردپرس فعال کنید.
  2. وارد منوی “Text Modal” شوید.

نحوه استفاده / عملکرد افزونه

  1. وارد صفحه مدیریت افزونه شوید.
  2. یک مودال متنی جدید بسازید.
  3. محتوای مودال را وارد کنید.
  4. تأخیر نمایش، مخاطب، دستگاه، زمان‌بندی و دکمه‌ها را تنظیم کنید.
  5. مودال را ذخیره کنید.
  6. مودال را فعال کنید.

فقط مودال فعال و منتشرشده در فرانت‌اند نمایش داده می‌شود.

مودال در این شرایط نمایش داده نمی‌شود:

  • هیچ مودالی فعال نباشد
  • مودال فعال منتشر نشده باشد
  • کاربر با مخاطب انتخاب‌شده تطابق نداشته باشد
  • دستگاه کاربر با تنظیمات دستگاه تطابق نداشته باشد
  • زمان فعلی خارج از زمان‌بندی باشد
  • مسیر فعلی جزو مسیرهای حساس باشد
  • محدودیت نمایش در سشن پر شده باشد

ذخیره‌سازی داده

افزونه داده‌های مودال را به‌صورت یک custom post type مخفی ذخیره می‌کند.

تنظیمات مودال در post meta ذخیره می‌شود، از جمله:

  • محتوای مودال
  • تنظیمات تأخیر
  • تنظیمات دکمه‌ها
  • هدف‌گیری مخاطب
  • هدف‌گیری دستگاه
  • زمان‌بندی
  • بستن خودکار
  • تنظیمات فونت
  • شمارنده‌های آماری

شناسه مودال فعال نیز به‌صورت WordPress option ذخیره می‌شود.

توسعه

توسعه داده‌شده بر اساس:

  • WordPress Coding Standards
  • Native WordPress APIs
  • Custom Post Types
  • Post Meta
  • Options API
  • AJAX API
  • Admin Menu API
  • WordPress editor
  • ورودی‌های sanitize شده
  • خروجی‌های escape شده
  • رندر سبک در فرانت‌اند
  • معماری تک‌فایلی

هوک‌ها

افزونه از hookهای وردپرس زیر استفاده می‌کند:

  • init
  • admin_menu
  • admin_init
  • wp_footer
  • wp_ajax_fa_tm_track_event
  • wp_ajax_nopriv_fa_tm_track_event
  • before_delete_post
  • trashed_post

امنیت

افزونه شامل موارد زیر است:

  • جلوگیری از دسترسی مستقیم
  • صفحه مدیریت فقط برای مدیر
  • بررسی nonce برای عملیات مدیریتی
  • sanitize کردن ورودی‌ها
  • escape کردن خروجی‌ها
  • محدودسازی دسترسی مدیریت مودال
  • redirect امن بعد از عملیات مدیریتی

بهبودهای آینده

  • خروجی و ورودی گرفتن از تنظیمات مودال
  • صفحه تنظیمات
  • دکمه ریست آمار
  • گزینه‌های بیشتر برای محل نمایش

مجوز

GPL-2.0-or-later

نویسنده

Amirreza Shayesteh Far

GitHub: https://github.com/amirrezashf

Read the full README on GitHub →