From 195d2cdd3d8049ca369039598f58549a393b1e4e Mon Sep 17 00:00:00 2001 From: Adam Wood <1017872+adamwoodnz@users.noreply.github.com> Date: Wed, 24 Apr 2024 13:43:07 +1200 Subject: [PATCH] Add local nav items --- .../themes/pub/wporg-learn-2024/functions.php | 32 +++++++++++++++++++ .../pub/wporg-learn-2024/parts/header.html | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/wp-content/themes/pub/wporg-learn-2024/functions.php b/wp-content/themes/pub/wporg-learn-2024/functions.php index 93773d89b5..abf1c574df 100644 --- a/wp-content/themes/pub/wporg-learn-2024/functions.php +++ b/wp-content/themes/pub/wporg-learn-2024/functions.php @@ -6,6 +6,7 @@ * Actions and filters. */ add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_assets' ); +add_filter( 'wporg_block_navigation_menus', __NAMESPACE__ . '\add_site_navigation_menus' ); /** * Enqueue scripts and styles. @@ -21,3 +22,34 @@ function enqueue_assets() { filemtime( __DIR__ . '/build/style/style-index.css' ) ); } + +/** + * Provide a list of local navigation menus. + */ +function add_site_navigation_menus( $menus ) { + return array( + 'learn' => array( + array( + 'label' => __( 'Courses', 'wporg-learn' ), + 'url' => '/courses/', + ), + array( + 'label' => __( 'Lessons', 'wporg-learn' ), + 'url' => '/lessons/', + ), + array( + 'label' => __( 'Learning Pathways', 'wporg-learn' ), + 'url' => '/learning-pathways/', + ), + array( + 'label' => __( 'Contribute', 'wporg-learn' ), + 'url' => '/contribute/', + ), + array( + 'label' => __( 'Instruct', 'wporg-learn' ), + 'url' => '/instruct/', + ), + ), + ); +} + diff --git a/wp-content/themes/pub/wporg-learn-2024/parts/header.html b/wp-content/themes/pub/wporg-learn-2024/parts/header.html index 5029dae671..768b1f863b 100644 --- a/wp-content/themes/pub/wporg-learn-2024/parts/header.html +++ b/wp-content/themes/pub/wporg-learn-2024/parts/header.html @@ -12,6 +12,6 @@ - +