Create your popup message in Wordpress using a shortcode
Create your popup message in Wordpress using a shortcode
by Marcel Badua |
tutorial |
On this tutorial, we will create a shortcode with content, and use of sessionStorage.
On your functions.php create your popup function
Inside your function, add this html that will display your popup on your page
Add this css to style your popup
Finally, add this script to trigger you popup message.
The sessionStorage will tell if the visitor has already visited the page before. If the visitor had visited it before the popup will not show, until the next session.
In your functions.php - hook your popup function to add_shortcode.
We can now add a shortcode to our post using [popup_message] I'm a popup message [/popup_message] adding all your content in between the shortcode.