Author | Posts |
---|---|
johannesodeg
December 10, 2021 at 2:27 pm
|
How to show/hide an element depending on logged in/out status? -Johannes |
Sebastian
December 11, 2021 at 10:37 am
|
Hey Johannes, It’s likely your theme adds classes to the body tag like “logged-in”. In which case, you could prepend your MT selector with that class to target content for logged in users e.g.
Or to target content for non-logged in users:
The troubleshooting video shows how to find these classes at 1:57 – in case one accidentally taps into them, but it may be helpful for your purposes too. If your theme doesn’t add logged in classes, you can install this simple plugin I made to do exactly that. Or copy the following PHP code to your child theme’s functions.php file:
If you use the plugin or sample code, the classes will be a bit different (with mt- prefix) e.g.
I hope that helps. Please let me know if you are still stuck. Thanks, |