• Hi guys – can you help me with adding a logout link to my footer? My site is here:

    https://www.bibliophone.com

    I don’t need the login link – that’s taken care of when a user tries to use the submission form. But I do need them to be able to logout. Is there a way I can have a link show up in my footer, and also specify that the logout only displays in my footer when a user is logged in??

    Thanks as always

    Paul

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hey Paul,
    Try to add this code into your footer menu (next to ‘Privacy Policy’)

    <?php
    if ( is_user_logged_in() ) {
     echo ' | <a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a>';
    };
    ?>
    Thread Starter paulmc911

    (@paulmc911)

    Hey Sumowebsite

    Thanks for that. In this theme the menu is actually in my hooks.php (I think that is unique to Omega theme?) and my footer content within hooks looks like this:

    /**
     * default footer insert filter
     */
    function omega_default_footer_insert( $settings ) {
    
    	return '<p class="copyright"> <a href="https://bibliophone.com/disclaimer/">Disclaimer</a> | <a href="https://bibliophone.com/privacy-policy/">Privacy Policy</a> </p>';	
    
    }

    So could you help me out with a basic question and show me where that code you just gave me should go in the above?! Thanks very much, really appreciate it.

    Paul

    /**
     * default footer insert filter
     */
    function omega_default_footer_insert( $settings ) {
       if ( is_user_logged_in() ) {
            return '<p class="copyright"> <a href="https://bibliophone.com/disclaimer/">Disclaimer</a> | <a href="https://bibliophone.com/privacy-policy/">Privacy Policy</a> | <a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a> </p>';
       } else {
    	return '<p class="copyright"> <a href="https://bibliophone.com/disclaimer/">Disclaimer</a> | <a href="https://bibliophone.com/privacy-policy/">Privacy Policy</a> </p>';
    }
    }
    Thread Starter paulmc911

    (@paulmc911)

    Hey Sumowebsite

    Thanks so much for that. I’ve entered the code in exactly as you wrote it but not seen anything – no logout appears at all.

    Do you think that menu appears somewhere else in my files as well? I will have a look.

    Thanks

    Paul

    Thread Starter paulmc911

    (@paulmc911)

    Right, I also have this in my functions.php:

    add_filter('omega_footer_insert', 'my_omega_footer_insert', 11);
    
    function my_omega_footer_insert( $settings ) {
    	$year = date( 'Y' );
    	$siteurl = get_bloginfo( 'url' );
    	$sitename = get_bloginfo( 'name' );
    	return "<a href='https://bibliophone.com/about/'>About</a> | <a href='https://bibliophone.com/terms-of-use/'>Terms of Use</a> | <a href='https://bibliophone.com/privacy-policy/'>Privacy Policy</a><br>? <a href='$siteurl'>$sitename</a> $year</p>";
    }

    Will I need to change that too?

    Thanks

    Paul

    Thread Starter paulmc911

    (@paulmc911)

    Actually I notice that my functions.php represents a different menu?! Well, I should say, it represents the menu as it appears on the site at the moment, which is exactly what I want. The menu titles in my hooks.php are obviously from when I was playing around with it at an earlier stage. So i DO want the menu titles to appear as they do in the code above for my functions.php, and not how they are in my hooks.php! Sorry I am a complete pain in the backside. Do I need to change my hooks.php AND my functions.php then?!

    Thanks again, and apologies again.

    Paul

    Thread Starter paulmc911

    (@paulmc911)

    Right, so it looks like my functions.php overrides anything in hooks anyway, so I THINK I can just ignore my hooks.php and concentrate on amending my theme functions, right?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Adding a logout link to my footer’ is closed to new replies.