How to show a popup on a home page in WordPress?
This can be accomplished with WP Terms Popup pretty easily and the steps you take depend on how your site home page is defined and managed inside of WordPress.
A typical WordPress site has a home page setup in one of two ways:
- A page or post set to be the site home page under WordPress’ Reading Settings screen.
- A special template built in to the site’s theme that controls the home page display and its content.
This short tutorial will walk you through the steps you need to take in order to make sure your WP Terms Popup content is showing only on your home page, and no other page or post on your site, quickly and easily.
When Your Home Page is a Post
The easiest way to define a home page in WordPress is to make a page or post and assign it as such. If you log into your WordPress site and go to the Settings menu at the bottom you will find a submenu called Reading. Clicking on that submenu will present you with a screen full of options but what you want is located at the top and should look something like this:
If what you see is similar to the above screenshot then you are using a post as your home page. Take not of what piece of content on your site has been selected (in our case, it’s a page called “Welcome to WP Terms Popup”) and pull that content up the WordPress post editor.
With WP Terms Popup installed and activated each page and post of your site will have a new option in the sidebar of the editor. You can find it on the lower right hand side of the editor screen.
This option changes based on your plugin settings but, for this example, our site has sitewide popups turned off. Here’s a closer look at what WP Terms Popup’s post settings looks like:
To turn on your popup on your home page post check the Enable Popup? box, select the popup you want to show on your home page from the dropdown, and make sure you save your post.
As soon as the post is saved your site will immediately start serving a popup on its homepage through the WP Terms Popup plugin.
When Your Home Page is Part of a WordPress Theme
This is a little trickier to deal with but it can be done. As a fair warning, this technique sometimes delivers mixed results and really depends on how your WordPress theme is constructed in terms of its code and design.
In order to force a WP Terms Popup to show on a site with a homepage controlled by a theme you’ll need to insert some code. Please be aware that this requires some theme and coding knowledge to accomplish and shouldn’t be done unless you are confident you can safely edit your site’s theme.
What you need to do is first find the shortcode for the WP Terms Popup you want on your homepage. Shortcodes for all popups are available on the All Popups section of the WP Terms Popup area of the WordPress admin. Each popup has its shortcode displayed in the second column of the list:
In our example screenshot, the shortcode is this:
Once you’ve copied that tiny shortcode you need to add it to your home page template file in your theme. The location of this varies from theme to theme so you’ll have to discover the right place to put this on your own.
With the right file found you need to insert the following line of code into your homepage layout using the WordPress do_shortcode function:
<?php echo do_shortcode('[wpterms id="5"]'); ?>
Save your template file and upload it back to your site via FTP. Again, please be careful with this approach as you can definitely mess up your site if you make the wrong step.
Those are the two best ways to make a popup on the home page in WordPress using the WP Terms Popup plugin.