Note: this tutorial is very easy if you have some basic knowledge about editing WordPress theme files.
Some email marketing service providers such as GetResponse, AWeber, and MailChimp have their own code for producing beautiful popups. In this guide I’ll show you how to properly and easily insert the popup code in WordPress. I’ll also show you what to do if you want to display the popup only on the front page or on specific posts.
For this example, I’ll use GetResponse‘s popup embed code. If you are with another provider, it shouldn’t be a problem. The steps are the same.
Here’s the code I got from GetResponse.
<script type="text/javascript" src="http://www.getresponse.com/view_webform.js?wid=43052"></script>This code needs to be embedded in the footer.php file of your WordPress theme. It should go right before the closing </body> tag like this:
<script> type="text/javascript" src="http://www.getresponse.com/view_webform.jswid=43052"></script> </body>
That’s it! Now whenever someone lands on your website for the first time, the popup will welcome them. The way GetResponse’s popup in particular works is like this: it is displayed only once — at the first time a visitor is on your site. If they fill out the form then good. If they don’t, too bad for you because the visitor ain’t gonna see the popup form again until the cookie expires, which is after 24 hours. Every email marketing provider has a popup form that works differently.
Showing the popup on the front page only
To show the popup on the front page, you’ll place the embed code in the same spot as above but you’ll add some PHP code to it. Here’s how it looks like:
<?php if (is_front_page()): ?><script type="text/javascript" src="http://www.getresponse.com/view_webform.js?wid=43052"></script><?php endif; ?> </body>
Now the popup will only show when the visitor is on the front page of your WordPress site.
Showing the popup on specific WordPress posts or pages
To show the popup on specific posts or pages, you’ll use different PHP code from the one above, but you’ll remain in footer.php and at the same spot.
So, if you want to show the popup in posts whose IDs are: 188, 442, and 429, here’s how you’d do it:
<?php global $post; ?> <?php if (in_array($post->ID, array(188, 442, 429))): ?> <script type="text/javascript" src="http://www.getresponse.com/view_webform.js?wid=43052"></script> <?php endif; ?> </body>
Replace the comma-separated list of post IDs with your own IDs and you’re set.





Worked for me.Thanks for this post
Hey Great Stuff, Dude!
Listen, if anyone knows this answer, you do. I don’t want an automatic loaded pop-up for opt-in. I simply want to create a form that will load in a pop-up light box effect window when a link is clicked. This form would email directly to me the information designed into the form. It would also provide the ability to give the visitor a confirmation that the form was successfully sent. There are tons of light boxes for WP and there are certainly a number of form applications.
But I want someone to be able to load a contact form or subscribe to a newsletter by clicking a link and not leaving that page.
What’s the best way to do this?
Thanks!!!
Hi AFK, Thanks for your kind words and apologies for the late reply. There’s the SimpleModal Contact Form, which allows you to create a popup contact form as you described.
As for newsletter sign up through the same technique, you’ll have to use the PlatinumPopup plugin. It’s the only one I know of that has this feature. Having said that, the functionality that you’re requiring can be implemented with a bit of coding and without a plugin, if you knew how to do that.
nice but not working on my blog.
Too bad.
thanks for your great post , i have a question , when i apply "Showing the popup on specific WordPress posts or pages" the popup appear in the specific post and home , i want it to appear only in the post . Please help me
Dauom, this is a simple code. It will not display the popup on posts other than those specified in the array. Maybe you have the homepage ID in the array or you have some other piece of code or a plugin that's causing the popup to show on the homepage.
it work correctly now , thanks.