Skip to content

Commit

Permalink
Navigation: Add "Log in" link to local nav (#156)
Browse files Browse the repository at this point in the history
* Navigation: Add "Sign in" link to local nav

See WordPress/wporg-mu-plugins#647

* Pass current page for post-login redirection

* Update text to "Log in"

* Fix duplicate site path in redirect
  • Loading branch information
ryelle authored Sep 10, 2024
1 parent 7648ab3 commit f52089c
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,14 @@ function add_site_navigation_menus( $menus ) {
'url' => '/browse/favorites/',
'className' => ( 'favorites' === $current_browse ? 'current-menu-item ' : '' ) . 'has-separator',
);
if ( ! is_user_logged_in() ) {
global $wp;
$redirect_url = home_url( $wp->request );
$menu[] = array(
'label' => __( 'Log in', 'wporg-themes' ),
'url' => wp_login_url( $redirect_url ),
);
}

$browse_menu = array(
array(
Expand Down

0 comments on commit f52089c

Please sign in to comment.