diff --git a/source/wp-content/themes/wporg-developer-2023/functions.php b/source/wp-content/themes/wporg-developer-2023/functions.php index 1a61ae532..044ae948b 100644 --- a/source/wp-content/themes/wporg-developer-2023/functions.php +++ b/source/wp-content/themes/wporg-developer-2023/functions.php @@ -177,6 +177,7 @@ require_once __DIR__ . '/src/command-github/block.php'; require_once __DIR__ . '/src/command-title/block.php'; require_once __DIR__ . '/src/command-subcommand/block.php'; +require_once __DIR__ . '/src/page-title/index.php'; require_once __DIR__ . '/src/reference-new-updated/block.php'; require_once __DIR__ . '/src/resource-select/index.php'; require_once __DIR__ . '/src/search-filters/index.php'; diff --git a/source/wp-content/themes/wporg-developer-2023/inc/block-hooks.php b/source/wp-content/themes/wporg-developer-2023/inc/block-hooks.php index 2be763f16..8622d82f9 100644 --- a/source/wp-content/themes/wporg-developer-2023/inc/block-hooks.php +++ b/source/wp-content/themes/wporg-developer-2023/inc/block-hooks.php @@ -8,6 +8,7 @@ use function DevHub\is_parsed_post_type; add_filter( 'render_block', __NAMESPACE__ . '\filter_handbook_meta_link_block', 10, 2 ); +add_filter( 'render_block_data', __NAMESPACE__ . '\modify_header_template_part' ); /** * Filters the search block and conditionally inserts search filters. @@ -77,3 +78,32 @@ function filter_handbook_meta_link_block( $block_content, $block ) { return $block_content; } + +/** + * Update header template based on current query. + * + * @param array $parsed_block The block being rendered. + * + * @return array The updated block. + */ +function modify_header_template_part( $parsed_block ) { + if ( + 'core/template-part' === $parsed_block['blockName'] && + ! empty( $parsed_block['attrs']['slug'] ) && + str_starts_with( $parsed_block['attrs']['slug'], 'header' ) + ) { + $template_slug = 'header-third'; + if ( + function_exists( 'wporg_is_handbook' ) && + wporg_is_handbook() && + ! wporg_is_handbook_landing_page() + ) { + $parsed_block['attrs']['slug'] = $template_slug; + } elseif ( 'command' === get_post_type() && is_single() ) { + $parsed_block['attrs']['slug'] = $template_slug; + } elseif ( is_parsed_post_type() && ! is_search() ) { + $parsed_block['attrs']['slug'] = $template_slug; + } + } + return $parsed_block; +} diff --git a/source/wp-content/themes/wporg-developer-2023/parts/header-alt.html b/source/wp-content/themes/wporg-developer-2023/parts/header-alt.html new file mode 100644 index 000000000..7c718930a --- /dev/null +++ b/source/wp-content/themes/wporg-developer-2023/parts/header-alt.html @@ -0,0 +1,15 @@ + + + + + +
+ + + +
+ + + + + diff --git a/source/wp-content/themes/wporg-developer-2023/parts/header-third.html b/source/wp-content/themes/wporg-developer-2023/parts/header-third.html new file mode 100644 index 000000000..8cd3a9a85 --- /dev/null +++ b/source/wp-content/themes/wporg-developer-2023/parts/header-third.html @@ -0,0 +1,28 @@ + + + + + + + +
+ + + +
+ + + + + + + +
+ + + +
+ diff --git a/source/wp-content/themes/wporg-developer-2023/parts/header.html b/source/wp-content/themes/wporg-developer-2023/parts/header.html index 6542d790a..67667df02 100644 --- a/source/wp-content/themes/wporg-developer-2023/parts/header.html +++ b/source/wp-content/themes/wporg-developer-2023/parts/header.html @@ -5,14 +5,5 @@ - - - - -
- - - -
- + diff --git a/source/wp-content/themes/wporg-developer-2023/patterns/front-page-header.php b/source/wp-content/themes/wporg-developer-2023/patterns/front-page-header.php index bac2eff2e..765b3db57 100644 --- a/source/wp-content/themes/wporg-developer-2023/patterns/front-page-header.php +++ b/source/wp-content/themes/wporg-developer-2023/patterns/front-page-header.php @@ -9,9 +9,7 @@ - - - + diff --git a/source/wp-content/themes/wporg-developer-2023/patterns/search-content.php b/source/wp-content/themes/wporg-developer-2023/patterns/search-content.php index c015dba7d..63d5f3536 100644 --- a/source/wp-content/themes/wporg-developer-2023/patterns/search-content.php +++ b/source/wp-content/themes/wporg-developer-2023/patterns/search-content.php @@ -13,8 +13,8 @@
- -