From 4031ca916c256c2f232581e856eb4a129adf48c6 Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Wed, 18 Sep 2024 12:30:10 -0700 Subject: [PATCH] Navigation: Add "log in" link to local nav (#2885) --- wp-content/themes/pub/wporg-learn-2024/functions.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wp-content/themes/pub/wporg-learn-2024/functions.php b/wp-content/themes/pub/wporg-learn-2024/functions.php index 52157306e..c2b7ba72a 100644 --- a/wp-content/themes/pub/wporg-learn-2024/functions.php +++ b/wp-content/themes/pub/wporg-learn-2024/functions.php @@ -334,6 +334,14 @@ function add_site_navigation_menus( $menus ) { 'className' => 'has-separator', ), ); + if ( ! is_user_logged_in() ) { + global $wp; + $redirect_url = home_url( $wp->request ); + $menu[] = array( + 'label' => __( 'Log in', 'wporg-learn' ), + 'url' => wp_login_url( $redirect_url ), + ); + } $learning_pathways = get_terms( array(