Skip to content

Commit

Permalink
Add local nav items
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwoodnz committed Apr 24, 2024
1 parent 15a3d17 commit 195d2cd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
32 changes: 32 additions & 0 deletions wp-content/themes/pub/wporg-learn-2024/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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/',
),
),
);
}

2 changes: 1 addition & 1 deletion wp-content/themes/pub/wporg-learn-2024/parts/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
</div>
<!-- /wp:group -->

<!-- wp:navigation {"menuSlug":"main","icon":"menu","overlayBackgroundColor":"charcoal-2","overlayTextColor":"white","layout":{"type":"flex","orientation":"horizontal"},"fontSize":"small"} /-->
<!-- wp:navigation {"menuSlug":"learn","icon":"menu","overlayBackgroundColor":"charcoal-2","overlayTextColor":"white","layout":{"type":"flex","orientation":"horizontal"},"fontSize":"small"} /-->

<!-- /wp:wporg/local-navigation-bar -->

0 comments on commit 195d2cd

Please sign in to comment.