From c845746e873e03798ea168635c27028a208c0205 Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Tue, 10 Nov 2026 13:39:55 -0600 Subject: [PATCH] HelpHub: Point article breadcrumbs at Support and show the category Since the 2024 theme prints the bbPress breadcrumb on every page, HelpHub articles on the locale support sites got the forums trail: a "Forums" home crumb linking to /support/forums/, and no category. Category archives also showed the title of their first article as the current crumb. On HelpHub articles, version pages, and category archives, the home crumb now links to the Support home page and is labeled "Support". Articles get their category before the current crumb, and category archives use the category name. Forum pages are unchanged. Fixes #7703. Co-Authored-By: Claude Opus 5.5 --- .../pub/wporg-support-2024/functions.php | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/wordpress.org/public_html/wp-content/themes/pub/wporg-support-2024/functions.php b/wordpress.org/public_html/wp-content/themes/pub/wporg-support-2024/functions.php index 03f28ed012..ecbd660ee9 100644 --- a/wordpress.org/public_html/wp-content/themes/pub/wporg-support-2024/functions.php +++ b/wordpress.org/public_html/wp-content/themes/pub/wporg-support-2024/functions.php @@ -407,6 +407,11 @@ function wporg_support_breadcrumb() { $args['include_home'] = true; $args['home_text'] = __( 'Forums', 'wporg-forums' ); + // HelpHub pages aren't part of the forums. + if ( is_singular( array( 'helphub_article', 'helphub_version' ) ) || is_category() ) { + $args['home_text'] = esc_html__( 'Support', 'wporg-forums' ); + } + // Forum root $args['include_root'] = false; @@ -415,6 +420,11 @@ function wporg_support_breadcrumb() { $args['current_before'] = ''; $args['current_after'] = ''; + // bbPress would use the title of the first post in the archive. + if ( is_category() ) { + $args['current_text'] = esc_html( single_cat_title( '', false ) ); + } + return $args; } add_filter( 'bbp_before_get_breadcrumb_parse_args', 'wporg_support_breadcrumb' ); @@ -422,9 +432,27 @@ function wporg_support_breadcrumb() { add_filter( 'bbp_breadcrumbs', /** - * Filters the breadcrumbs to replace the home URL with the forums page. + * Filters the breadcrumbs to replace the home URL with the forums page, + * and to add the category to HelpHub articles. */ function( $crumbs ) { + if ( is_singular( 'helphub_article' ) ) { + $categories = get_the_category( get_queried_object_id() ); + + if ( $categories ) { + $category_crumb = sprintf( + '%2$s', + esc_url( get_category_link( $categories[0] ) ), + esc_html( $categories[0]->name ) + ); + array_splice( $crumbs, 1, 0, $category_crumb ); + } + } + + if ( is_singular( array( 'helphub_article', 'helphub_version' ) ) || is_category() ) { + return $crumbs; + } + foreach ( $crumbs as $i => $link ) { if ( str_contains( $link, 'bbp-breadcrumb-home' ) ) { $crumbs[ $i ] = str_replace( home_url(), home_url( '/forums/' ), $link );