WordPress plugin that shows a newsletter popup on the "Baza Wiedzy" category
single posts. Five seconds after the page loads it displays a modal with an
e-mail form; the submitted address is validated (including a disposable
e-mail domain blacklist), sent to the site administrator over AJAX
(wp_mail), and the popup is then suppressed for a year via a cookie.
taskscape-newsletter-popup.php the entire plugin — popup HTML, script/style
enqueue, AJAX handler
popup.js behaviour — timed display, validation,
submission, dismissal cookie
popup.css popup styling (dark overlay, modal, form)
images/
modal-newsletter.png illustration shown on the left side of the modal
- On
DOMContentLoadedthe popup is skipped when thetbnpDismissed=truecookie is present. - After 5 seconds the popup is shown and body scrolling is locked.
tbnpSubmit()validates the address format and rejects known disposable/temporary e-mail domains.- The address is POSTed to
admin-ajax.php(action=tbnp_submit); the server sends the notification to the site administrator and the cookie is set for 365 days. - Success message is shown for 3 seconds, then the popup closes and the scroll is unlocked.
- WordPress with PHP (no build step, no runtime dependencies beyond
WordPress core
wp_mail/admin-ajax).
- Copy the folder into
wp-content/plugins/(or zip it and upload through Plugins → Add New → Upload Plugin). - Activate Taskscape Newsletter Popup in the Plugins screen.
The popup appears automatically on single posts in the Baza Wiedzy
category — no configuration or shortcode needed. To change the recipient,
edit the address in wp_mail() in taskscape-newsletter-popup.php.