WordPress.org

Support

Support » How-To and Troubleshooting » wp_loginout() placement

wp_loginout() placement

  • Hello all!

    First of all a link to my site: http://xn--eventmors-t8a.dk/
    At the moment I’m trying to add wp_loginout() to my header. I’ve placed it after calling my nav-menu, but the ‘Log in’ and ‘Log out’ buttons still appear after the menu and not before. This is the header code:

    if (function_exists('wp_nav_menu')) { ?>
    
                      <?php if (is_user_logged_in()) { ?>   
    
                         <?php $primaryNav = wp_nav_menu( array( 'theme_location' => 'logged-in-menu', 'container' => '', 'fallback_cb' => '', 'menu_class' => $menuClass, 'menu_id' => $menuID, 'echo' => false ) ); ?>
                         <ul id="<?php echo $menuID; ?>" class="<?php echo $menuClass; ?>">
                            <?php wp_loginout($_SERVER['REQUEST_URI']); ?>
    
                      <?php } else { ?>
    
                         <?php $primaryNav = wp_nav_menu( array( 'theme_location' => 'logged-out-menu', 'container' => '', 'fallback_cb' => '', 'menu_class' => $menuClass, 'menu_id' => $menuID, 'echo' => false ) ); ?>
                         <ul id="<?php echo $menuID; ?>" class="<?php echo $menuClass; ?>">
                            <?php wp_loginout($_SERVER['REQUEST_URI']); ?>
    
                      <?php }
                   };

    I can’t seem to make wp_loginout() appear AFTER the menu. Any ideas? This is just a small detail, but it doesn’t really make sense having the Log in button appear before the menu itself.

  • The topic ‘wp_loginout() placement’ is closed to new replies.
Skip to toolbar