Skip to content

Commit

Permalink
About: Add the full About section menu to the About pages (#387)
Browse files Browse the repository at this point in the history
* About: Add the full About section menu to the About page

* Use "home" menu on all About subpages

* Remove self-link on About page

* Remove separate About section nav files in favor of a single subpage file
  • Loading branch information
ryelle authored Feb 12, 2024
1 parent af56900 commit 5bc9ab0
Show file tree
Hide file tree
Showing 19 changed files with 122 additions and 108 deletions.
154 changes: 90 additions & 64 deletions source/wp-content/themes/wporg-main-2022/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,73 +164,91 @@ function update_site_breadcrumbs( $breadcrumbs ) {
* Provide a list of local navigation menus.
*/
function add_site_navigation_menus( $menus ) {
return array(
'about-details' => array(
array(
'label' => __( 'Domains', 'wporg' ),
'url' => '/about/domains/',
),
array(
'label' => __( 'License', 'wporg' ),
'url' => '/about/license/',
),
array(
'label' => __( 'Accessibility', 'wporg' ),
'url' => '/about/accessibility/',
),
array(
'label' => __( 'Privacy Policy', 'wporg' ),
'url' => '/about/privacy/',
),
array(
'label' => __( 'Statistics', 'wporg' ),
'url' => '/about/stats/',
),
$about_details = array(
array(
'label' => __( 'Domains', 'wporg' ),
'url' => '/about/domains/',
),
'about-technology' => array(
array(
'label' => __( 'Requirements', 'wporg' ),
'url' => '/about/requirements/',
),
array(
'label' => __( 'Features', 'wporg' ),
'url' => '/about/features/',
),
array(
'label' => __( 'Security', 'wporg' ),
'url' => '/about/security/',
),
array(
'label' => __( 'Roadmap', 'wporg' ),
'url' => '/about/roadmap/',
),
array(
'label' => __( 'History', 'wporg' ),
'url' => '/about/history/',
),
array(
'label' => __( 'License', 'wporg' ),
'url' => '/about/license/',
),
'about-people' => array(
array(
'label' => __( 'Philosophy', 'wporg' ),
'url' => '/about/philosophy/',
),
array(
'label' => __( 'Etiquette', 'wporg' ),
'url' => '/about/etiquette/',
),
array(
'label' => __( 'Swag', 'wporg' ),
'url' => 'https://mercantile.wordpress.org/',
),
array(
'label' => __( 'Logos', 'wporg' ),
'url' => '/about/logos/',
),
array(
'label' => __( 'People of WordPress', 'wporg' ),
'url' => 'https://wordpress.org/news/category/community/',
),
array(
'label' => __( 'Accessibility', 'wporg' ),
'url' => '/about/accessibility/',
),
array(
'label' => __( 'Privacy Policy', 'wporg' ),
'url' => '/about/privacy/',
),
array(
'label' => __( 'Statistics', 'wporg' ),
'url' => '/about/stats/',
),
);
$about_technology = array(
array(
'label' => __( 'Requirements', 'wporg' ),
'url' => '/about/requirements/',
),
array(
'label' => __( 'Features', 'wporg' ),
'url' => '/about/features/',
),
array(
'label' => __( 'Security', 'wporg' ),
'url' => '/about/security/',
),
array(
'label' => __( 'Roadmap', 'wporg' ),
'url' => '/about/roadmap/',
),
array(
'label' => __( 'History', 'wporg' ),
'url' => '/about/history/',
),
);
$about_people = array(
array(
'label' => __( 'Philosophy', 'wporg' ),
'url' => '/about/philosophy/',
),
array(
'label' => __( 'Etiquette', 'wporg' ),
'url' => '/about/etiquette/',
),
array(
'label' => __( 'Swag', 'wporg' ),
'url' => 'https://mercantile.wordpress.org/',
),
array(
'label' => __( 'Logos', 'wporg' ),
'url' => '/about/logos/',
),
array(
'label' => __( 'People of WordPress', 'wporg' ),
'url' => 'https://wordpress.org/news/category/community/',
),
);
$about_home = array(
array(
'label' => __( 'The technology', 'wporg' ),
'submenu' => $about_technology,
),
array(
'label' => __( 'The details', 'wporg' ),
'submenu' => $about_details,
),
array(
'label' => __( 'The people', 'wporg' ),
'submenu' => $about_people,
),
);
return array(
'about-home' => $about_home,
'about-details' => $about_details,
'about-technology' => $about_technology,
'about-people' => $about_people,
'download' => array(
array(
'label' => __( 'Releases', 'wporg' ),
Expand Down Expand Up @@ -271,6 +289,14 @@ function use_parent_page_title( $block_content, $block, $instance ) {
);
}

if ( is_page( 'about' ) ) {
return str_replace(
array( home_url(), get_bloginfo( 'name' ) ),
array( home_url( '/about/' ), __( 'About', 'wporg' ) ),
$block_content
);
}

$parent = get_post_parent();
if ( ! $parent ) {
return $block_content;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
// phpcs:disable WordPress.Files.FileName -- Allow underscore for pattern partial.
/**
* Title: Section Nav (About - Home)
* Slug: wporg-main-2022/nav-about-home
* Inserter: no
*/

?>
<!-- wp:wporg/local-navigation-bar {"style":{"color":{"background":"#f0ede7"},"border":{"bottom":{"color":"var:preset|color|black-opacity-15","width":"1px"}},"spacing":{"padding":{"right":"var:preset|spacing|edge-space","left":"var:preset|spacing|edge-space","top":"16px","bottom":"16px"}},"position":{"type":"sticky"}},"textColor":"charcoal-1","fontSize":"small"} -->
<!-- wp:site-title {"level":0,"fontSize":"small","isLink":false} /-->

<!-- wp:navigation {"menuSlug":"about-home","textColor":"charcoal-1","icon":"menu","customOverlayBackgroundColor":"#f0ede7","layout":{"type":"flex","orientation":"horizontal"},"fontSize":"small","openSubmenusOnClick":true} /-->
<!-- /wp:wporg/local-navigation-bar -->

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
// phpcs:disable WordPress.Files.FileName -- Allow underscore for pattern partial.
/**
* Title: Section Nav (About - Details)
* Slug: wporg-main-2022/nav-about-details
* Title: Section Nav (About - Subpage)
* Slug: wporg-main-2022/nav-about-subpage
* Inserter: no
*/

?>
<!-- wp:wporg/local-navigation-bar {"backgroundColor":"white","style":{"spacing":{"padding":{"right":"var:preset|spacing|edge-space","left":"var:preset|spacing|edge-space","top":"16px","bottom":"16px"}},"position":{"type":"sticky"},"border":{"top":{"color":"var:preset|color|light-grey-1","style":"solid","width":"1px"},"right":{},"bottom":{"color":"var:preset|color|light-grey-1","style":"solid","width":"1px"},"left":{}}},"textColor":"charcoal-1","fontSize":"small"} -->
<!-- wp:site-title {"level":0,"fontSize":"small"} /-->

<!-- wp:navigation {"menuSlug":"about-details","textColor":"blueberry-1","icon":"menu","layout":{"type":"flex","orientation":"horizontal"},"fontSize":"small"} /-->
<!-- wp:navigation {"menuSlug":"about-home","textColor":"blueberry-1","icon":"menu","layout":{"type":"flex","orientation":"horizontal"},"fontSize":"small","openSubmenusOnClick":true} /-->
<!-- /wp:wporg/local-navigation-bar -->

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<!-- wp:wporg/global-header {"style":"white-on-black"} /-->

<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-home"} /-->

<!-- wp:group {"tagName":"main","layout":{"inherit":true},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">
<!-- wp:pattern {"slug":"wporg-main-2022/about"} /-->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- wp:wporg/global-header {"style":"black-on-white"} /-->

<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-details"} /-->
<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-subpage"} /-->

<!-- wp:group {"tagName":"main","layout":{"inherit":true},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- wp:wporg/global-header {"style":"black-on-white"} /-->

<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-details"} /-->
<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-subpage"} /-->

<!-- wp:group {"tagName":"main","layout":{"inherit":true},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- wp:wporg/global-header {"style":"black-on-white"} /-->

<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-people"} /-->
<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-subpage"} /-->

<!-- wp:group {"tagName":"main","layout":{"inherit":true},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- wp:wporg/global-header {"style":"black-on-white"} /-->

<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-technology"} /-->
<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-subpage"} /-->

<!-- wp:group {"tagName":"main","layout":{"inherit":true},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- wp:wporg/global-header {"style":"black-on-white"} /-->

<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-technology"} /-->
<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-subpage"} /-->

<!-- wp:group {"tagName":"main","layout":{"inherit":true},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- wp:wporg/global-header {"style":"black-on-white"} /-->

<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-details"} /-->
<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-subpage"} /-->

<!-- wp:group {"tagName":"main","layout":{"inherit":true},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- wp:wporg/global-header {"style":"black-on-white"} /-->

<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-people"} /-->
<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-subpage"} /-->

<!-- wp:group {"tagName":"main","layout":{"inherit":true},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- wp:wporg/global-header {"style":"black-on-white"} /-->

<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-people"} /-->
<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-subpage"} /-->

<!-- wp:group {"tagName":"main","layout":{"inherit":true},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- wp:wporg/global-header {"style":"black-on-white"} /-->

<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-details"} /-->
<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-subpage"} /-->

<!-- wp:group {"tagName":"main","layout":{"inherit":true},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- wp:wporg/global-header {"style":"black-on-white"} /-->

<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-technology"} /-->
<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-subpage"} /-->

<!-- wp:group {"tagName":"main","layout":{"inherit":true},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- wp:wporg/global-header {"style":"black-on-white"} /-->

<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-technology"} /-->
<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-subpage"} /-->

<!-- wp:group {"tagName":"main","layout":{"inherit":true},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- wp:wporg/global-header {"style":"black-on-white"} /-->

<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-technology"} /-->
<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-subpage"} /-->

<!-- wp:group {"tagName":"main","layout":{"inherit":true},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- wp:wporg/global-header {"style":"black-on-white"} /-->

<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-details"} /-->
<!-- wp:pattern {"slug":"wporg-main-2022/nav-about-subpage"} /-->

<!-- wp:group {"tagName":"main","layout":{"inherit":true},"className":"entry-content","style":{"spacing":{"blockGap":"0px"}}} -->
<main class="wp-block-group entry-content">
Expand Down

0 comments on commit 5bc9ab0

Please sign in to comment.