How to Create PopUPS in WordPress Without Plugins?
In this article, we will be discussing how to create popUPS in WordPress without using any plugins. We will be using the built-in WordPress features and the TinyMCE editor.
First, we will need to create a new file in our WordPress site. We will name this file “popUPS.
php” and place it in our WordPress folder.
Next, we will need to create a few lines of code in our popUPS.php file. We will start by defining a few global variables. The first variable is “$message”. This variable will contain the message that will be displayed when the popup is triggered. The second variable is “$template”.
This variable will contain the template that will be used to create the popup. The third variable is “$position”. This variable will contain the position of the popup on the page. The final variable is “$args”. This variable will contain the arguments that will be passed to the template when it is triggered.
Now, we will create the template that will be used to create the popup. We will start by creating a new file in our TinyMCE editor and name this file “popup.
tmpl”. We will then paste the following code into this file.
Now, we will create the content for the popup. We will start by defining a few variables. The first variable is “$content”. This variable will contain the content that will be displayed when the popup is triggered. The second variable is “$title”. This variable will contain the title of the popup.
The third variable is “$message”. The fourth variable is “$closebtn”. This variable will contain the close button that will be used to close the popup. The final variable is “$active”. This variable will contain the status of the close button.
Now, we will create the event handler for the popup.
php”.
Now, we will define the trigger for the popup. We will start by creating a new file in our TinyMCE editor and name this file “trigger.
trigger(‘popup’, ‘popup.tmpl’);
Now, we will define the action for the popup. We will start by creating a new file in our TinyMCE editor and name this file “action.
action(‘popup.tmpl’);
Finally, we will define the popUPS settings. We will start by creating a new file in our TinyMCE editor and name this file “settings.
define( ‘WP_USE_THEMES’, true );
define( ‘WP_USE_WIDGETS’, true );
define( ‘WP_USE_THEME_WITH_WIDGET’, true );
define( ‘WP_PLAYBACK_MODE’, ‘never’ );
define( ‘WPBakeryShortCode_VERSION’, ‘4.4’ );
Now, we will define the popUPS settings for our site. We will start by creating a new file in our TinyMCE editor and name this file “popUPS.
define( ‘WP_POPUP_ORDER’, ‘bottom’ );
define( ‘WP_POPUP_EXIT_ON_CLOSE’, false );
define( ‘WP_POPUP_POSITION’, ‘middle’ );
define( ‘WP_POPUP_MESSAGE’, ‘This is a popup!’ );
define( ‘WP_POPUP_TITLE’, ‘My Popup!’ );
define( ‘WP_POPUP_CLOSE_BUTTON_TEXT’, ‘Close popup?’ );.