• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How to create login/log out menu link

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › How to create login/log out menu link

This topic is: not resolved
  • This topic has 2 replies, 2 voices, and was last updated 12 years ago by James.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • April 23, 2013 at 9:51 pm #37319
    James
    Participant

    Hey all !

    Does anyone know how to create a login/log out link in the menu?

    when the user is NOT logged in, it should say "login"

    when the user IS logged in it should say "log out"

    when the user logs in it would redirect to a page, say a login page (where i'll have the log in form)

    and when the user logs out, it might go to the home page, or a log out page.

    i think it is not that complicated to do, just can't seem to work it out, i checked the wordpress codex for login redirects, and there is some info there, but couldn't really get it together.

    I'm using Premise too

    LOTS of folks are trying to do this out there, so any help will be useful to many

    thanks in advance 🙂

    April 23, 2013 at 11:45 pm #37334
    Brad Dalton
    Participant

    There's already a shortcode for this which you can access using Genesis Simple Edits plugin.

    Otherwise you can add a custom link in your menu or echo the link to output in any Genesis hook location using a custom function.

    You can also echo the shortcode in the custom function


    Tutorials for StudioPress Themes.

    April 29, 2013 at 4:38 am #38379
    James
    Participant

    Thanks Brad

    i found this shortcode

     

    [footer_loginout redirect to "www.mysite.com/somepage"]

     

    and added that via a function

    works great but if someone has a sec could they check i have done it right?

     

    // Add Login/out to primary nav
    add_filter('wp_nav_menu_items','my_item', 11, 2);
    function my_item($items, $args) {

    if( is_admin() ||  $args->theme_location != 'primary' )
    return $items;

    $items .= '<li class="right">' . do_shortcode('[footer_loginout redirect="http://penyinternational.com/files/contact/"]') . '</li>';
    return $items;
    }

     

     

    thanks again

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble