I want to execute custom jquery code which shows login dialog to user if he clicks a button and he is not logged in. How could I do that?
|
In case you want to know if the user is logged in at the current moment. The other answers check if the user is logged in or not when the page loaded not the time when you're running the javascript. The user could have logged in in a seperate tab for instance Put this in your javascript
put this in your functions.php
|
|||||||||||
|
|
Check the You can also just use |
|||
|
|
|
Another example, in case you want to use it for AJAX calls.
|
|||
|
|
|
Please add body_class() to your html body
This will add
|
|||
|
|