Skip to content

Commit

Permalink
Ensure handbooks load the handbook template
Browse files Browse the repository at this point in the history
Community handbooks such as https://make.wordpress.org/community/handbook/community-team/ were loading the single template.
This change adds the single handbook template to the hierarchy.

Fixes WordPress/wordpress.org#450
  • Loading branch information
adamwoodnz committed Dec 17, 2024
1 parent 440c47c commit 424e972
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/wp-content/themes/wporg-make-2024/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,10 @@ function set_site_breadcrumbs( $breadcrumbs ) {
* @return string[] Updated list of templates.
*/
function add_handbook_templates( $templates ) {
if ( function_exists( 'wporg_is_handbook' ) && wporg_is_handbook() ) {
array_unshift( $templates, 'single-handbook.php' );
}

$is_github_source = ! empty( get_post_meta( get_the_ID(), 'wporg_cli_markdown_source', true ) ) || ! empty( get_post_meta( get_the_ID(), 'wporg_markdown_source', true ) );

if ( $is_github_source ) {
Expand Down

0 comments on commit 424e972

Please sign in to comment.