Your Uncommonly Amazing WordPress Tech Partner

Showing and hiding the Divi Area Popup using inner content as a trigger

DIVI AREAS PRO

Divi Area Popups have a limited amount of triggers.

And if you want to link it to Memberpress login form success/failed response you won't be able to do it from the admin panel.

So today I will show how to do it using Divi Area JS API.

The result will be the popup that will be triggered on the some dynamic message.

diviAreaPopup

What You'll Need For This Tutorial

1 – Divi Area Pro plugin 

2 – Memberpress plugin 

3 – Divi builder 

Create and link the popup

1.1 – Open the Divi Area section.

1.2 – Click on the “Add new” button.

Screenshot

1.3 – Enter the popup content. I will add the Memberpress login form. 

Screenshot

1.4 – Choose the condition where do you want to open this popup. I will choose to open it on a specific page.  

Screenshot

 

1.5 – Save the Divi Area Popup.

Screenshot

Create a JS script to manage popup

2.1 – Create a code block on the page where you want to use your popup 

Screenshot

2.2 – Add the next script there:

<script type=“text/javascript”>
    window.addEventListener(‘load', function () {
        var meprError = DiviArea.getArea(‘#regPopup').find(‘.mepr_error')[0];        
            if ( meprError !== undefined ) DiviArea.show(“#regPopup”);
    });
</script>

Screenshot

 

2.3 – You only need to insert the popup ID you see on the popup admin page instead of #regPopup

Screenshot

 

2.4 – If you want to trigger the popup on another message or content appearing you need to change this part .find(‘.mepr_error') and add the ID or class you need.

 

Screenshot

 

2.5 – If you want to hide popup instead of showing you can change the DiviArea.show to DiviArea.hide function.

Screenshot

 

2.6 – Save the changes you made on the page.

 

Screenshot

 

That's all.

Now every time the Memberpress error will appear the popup will show up and the user will see it. 

Now let’s hear from you!

Are you using Divi Content Area?

Tell us how in the comments section below!

What do you think of this tutorial?

Book Title: Showing and hiding the Divi Area Popup using inner content as a trigger

Book Description: How to show or hide the Divi Area Popup according to content that appears on this popup.

Book Author: Victor Barannik

Book Edition: Memberfix

Publisher Logo: MemberFix

User Review
0 (0 votes)

You may also enjoy...

WordPress based membership sites have certain requirements, and make use of certain applications that, in my experience, makes most of the popular hosting providers a poor choice.
Learn how to redirect users to different post-login pages depending on their current membership or even their past membership in WooCommerce!

What would you do if half your clients didn’t show up—and you couldn’t do anything about it? That was Debbie Caudle’s reality as a therapist accepting Medicaid clients in 2011.

Not all themes are equally good for a WordPress membership site. We rely primarily on ONE excellent WP theme. Click to learn more…

Leave a Reply

Your email address will not be published. Required fields are marked *