Adding Popups on your WordPress site

Last Updated: 15.07.2019

I. I want to add a popup to my landing page and I have installed the dedicated WordPress plugin

If you use one of our plugins (Landing Pages App or Landingi Landing Pages) and you have your landing page imported thanks to it, you do not have to do anything else – the code enabling the display of the popup will be added automatically in the final stage of creating the popup:

PWP1_EN

II. I want to add a popup to another page powered by WordPress

If you want your pop-up to be added to your own different site powered by WordPress, take the steps given below:

1. In the final stage of creating the pop-up, copy the automatically generated HTML code:

PWP5_EN

2. In WordPress dashboard, in the menu on the left, go to Appearance (1), then click on Editor (2).

PWP6_EN

3. You will see the window with the option to edit the theme in a source code. On the right side, click on Theme Header file (header.php).

PWP4_EN

4. After that, you will see the window with the <!doctype html> code. The generated code should be pasted to the section, preferably at its end. Remember to do so before the tag!

Important: after pasting the code into the header.php file, it will be installed automatically for the whole page together with all its subpages.

What to do when you want to define where exactly the popup will display?
A. I want my popup to display only on the one or chosen subpages

1. Copy the code:

<?php if (is_page(['subpage_name'])) : ?>
		<script src="https://popups.landingi.com/api/website/install-code?apikey=92cff2ab-e9ca-41e5-9bc3-e9737550fe5c"></script>
	<?php endif; ?> 

In the first function (1st line) define on which subpage (or more subpages) the popup should display [‘subpage_name’, ‘subpage_name’].

In the second line, replace our example with your own generated code from the last step of publication. Then, paste the whole code at the end of the section.

code1EN

2. Click Update File.

B. I want my popup to display on all of the pages except the selected ones…

1. Analogously, as shown above, copy the code containing negation (!):

<?php if !(is_page(['subpage_name'])) : ?>
<script src="https://popups.landingi.com/api/website/install-code?apikey=92cff2ab-e9ca-41e5-9bc3-e9737550fe5c"></script>
      <?php endif; ?>

In the first function (1st line) define on which subpage (or more subpages) the popup should not display [‘subpage_name’, ‘subpage_name’].

In the second line, replace our example with your own generated code from the last step of publication. Then, paste the whole code at the end of the section.

code2EN

2. Click Update File.

Was this article helpful?

You might also check:

pop-ups WordPress

Can’t find what you need?

Let us help you!
Send us a message
We are using cookies for analytical purpose. Learn more.