0

I want a popup (made with jquery) to appear AFTER the user login. And ONLY after login. I have searched google, but its hard to find a solution there. I know there is a hook called something like wp_login, but how can i get a css like display: block into there ?

1 Answer 1

0

Wordpress has a class when the user has been log in to the site.

.logged-in

You can use that to check with javascript and show the pop up.

This can be hidden if the user has not been logged in.

And if this you want to show only one time of x number of times you can do it with cookies (among other options)

$(document).ready(function() {
    if ($.cookie('cookiepopupcheck')){ 
        $('#welcome').hide();
    }else {
        $("#close-welcome").click(function() {
            $(".welcome").fadeOut(3000);
            $.cookie('cookiepopupcheck', true);    
        });
    }
});

File can be included with Enqueue And the this is the file github project

2
  • but i only need it to show ONE TIME after login, not every time the page loads. Only 1 time after login. Sep 15, 2017 at 9:50
  • Use a Cookie then :) updated the answer. Sep 15, 2017 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.