WORDPRESS | Add login logout shortcut in the footer

A simple shorcut this time to add a link to the wp-login page directly from the footer (in this case). you’ll be redirected, but the text will changed depending if you’re logged in or not.

Replace in the footer.php

<div id="footer" class="clearfix">
<p id="copyright"><a title="Elegant Themes" href="http://www.elegantthemes.com">Elegant Themes</a> | <a href="http://www.wordpress.org">Wordpress</a></p>
</div>

with

div id="footer" class="clearfix">
            <br /><p id="copyright"><?php if (is_user_logged_in()) : ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>">Se deconnecter | </a>
<?php else : ?> <a href="<?php echo wp_login_url(get_permalink()); ?>">Se connecter | </a>
<?php endif;?><?php _e('Designed by ','Professional'); ?> <a href="http://www.elegantthemes.com" title="Elegant Themes">Elegant Themes</a> | <?php _e('Powered by ','Professional'); ?> <a href="http://www.wordpress.org">Wordpress</a>
</p>
</div>

Note : This code snippet has been used in the footer of The Professional Theme from
elegantthemes

For the lazy here is “just” the code you can insert in any footer, or any place.

<?php if (is_user_logged_in()) : ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>">logout | </a>
<?php else : ?> <a href="<?php echo wp_login_url(get_permalink()); ?>">login | </a>
<?php endif;?>

Enjoy.


This is another follow-up of those two posts:
this post on the same subject : WORDPRESS | login form on the header or footer
and
WORDPRESS | Add login logout button to the menu bar

Olivier
About

Product and graphic designer turned to be a Mac SysAdmin.

Posted in Design, Development Tagged with: , , , ,
0 comments on “WORDPRESS | Add login logout shortcut in the footer
1 Pings/Trackbacks for "WORDPRESS | Add login logout shortcut in the footer"
  1. […] WORDPRESS | Add login logout shortcut in the footer | oemden on WORDPRESS | Add login logout button to the menu bar […]

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>