If you would like to have a clickable padlock icon link in WordPress that allows you to log in or log out, follow these easy steps:
1. In WordPress, go to Appearance > Theme Editor.
2. On the right, select functions.php
.
3. Scroll to the bottom of the page and copy and then paste the following lines of code:
4. At the bottom-left of the screen, press Update File.
Copy and then paste the following shortcode where you want the link to appear:
Where ever you placed the above shortcode, a padlock icon will appear. If you are logged in, the padlock icon will appear unlocked.
Clicking the unlocked padlock icon will log you out. Once you are logged out, the padlock icon will appear locked.
Clicking the locked padlock icon will take you to the login page.
I recommend placing the shortcode on the footer, but you do you.