• 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

ZachScr

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
  • Profile
  • Topics Started
  • Replies Created
  • Engagements
  • Favorites

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • September 9, 2015 at 8:17 am in reply to: Adding Login/Logout button to custom header menu in Parallax Pro #165027
    ZachScr
    Member

    Nevermind. I figured it out!

    For anyone looking for the same answer, I ended up replacing the wp_login_url and wp_logout_url with my own custom ones and that worked. So it looked like this:

    //Add login/logout link to naviagation menu
    function add_login_out_item_to_menu( $items, $args ){
    
    	//change theme location with your them location name
    	if( is_admin() ||  $args->theme_location != 'header' )
    		return $items; 
    
    	$redirect = ( is_home() ) ? false : get_permalink();
    	if( is_user_logged_in( ) )
    		$link = '<a href="' . wp_logout_url( home_url() ) . '" title="' .  __( 'Logout' ) .'">' . __( 'Logout' ) . '</a>';
    	else  $link = '<a href="' . site_url( '/log-in/' ) . '" title="' .  __( 'Login' ) .'">' . __( 'Login' ) . '</a>';
    
    	return $items.= '<li id="log-in-out-link" class="menu-item menu-type-link">'. $link . '</li>';
    }add_filter( 'wp_nav_menu_items', 'add_login_out_item_to_menu', 50, 2 );
    September 8, 2015 at 7:51 pm in reply to: Adding Login/Logout button to custom header menu in Parallax Pro #164991
    ZachScr
    Member

    Victor! It worked! thank you so much.

    Had to do a little CSS editing for it to sit correctly, but it looks good.

    One more question, do you know if it's possible to use a custom login url and a custom redirect link after they are logged out?

    September 8, 2015 at 6:16 pm in reply to: Primary Menu location #164974
    ZachScr
    Member

    Hi there,

    Hopefully this is the right place to ask this:

    I'm trying to add a Login|Logout button to my website's menu (parallax pro). I want the button to say "Logout" when the user is
    logged in, and "login" when they're logged out. I've found a good way to do this by adding custom code to the functions.php file.

    The code that I'm adding looks like this:

    //Add login/logout link to naviagation menu
    function add_login_out_item_to_menu( $items, $args ){
    
    	//change theme location with your them location name
    	if( is_admin() ||  $args->theme_location != 'primary' )
    		return $items; 
    
    	$redirect = ( is_home() ) ? false : get_permalink();
    	if( is_user_logged_in( ) )
    		$link = '<a href="' . wp_logout_url( $redirect ) . '" title="' .  __( 'Logout' ) .'">' . __( 'Logout' ) . '</a>';
    	else  $link = '<a href="' . wp_login_url( $redirect  ) . '" title="' .  __( 'Login' ) .'">' . __( 'Login' ) . '</a>';
    
    	return $items.= '<li id="log-in-out-link" class="menu-item menu-type-link">'. $link . '</li>';
    }add_filter( 'wp_nav_menu_items', 'add_login_out_item_to_menu', 50, 2 );

    Thing is, it only seems to work when the custom menu I'm using is set to "primary navigation menu". Of course if I set it as the primary navigation menu, I end up with two menu locations as discussed earlier in this thread (and the login/out button is only appears on the primary one). So I'd like to add the menu item to the custom menu without making it a "primary navigation menu".

    I think the issue is in the theme location line above but I'm not sure what to target instead of "primary".

    Anyone have any ideas? I feel like I've tried everything.

    February 13, 2015 at 2:57 pm in reply to: Raise home page widgets in parallax #140764
    ZachScr
    Member

    Worked perfectly!

    Thank you so much, Tonya!

    Zach

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 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