From 63456791441f05ae4988126cfe939e1b64d0c0d1 Mon Sep 17 00:00:00 2001 From: Konstantin Obenland Date: Tue, 10 Nov 2026 15:38:36 -0600 Subject: [PATCH 1/3] Translate: Merge the Plugins and Themes breadcrumbs into the project breadcrumb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The /projects/wp-plugins/ and /projects/wp-themes/ archives redirect to the homepage, so linking them from the breadcrumb sends people somewhere they didn't expect. Fold the Plugins or Themes label into the crumb of the plugin or theme that follows it, as in “Projects / Plugins: Plugin Name / Stable”. Fixes #7649. Co-Authored-By: Claude Opus 5.5 --- .../inc/class-plugin.php | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/class-plugin.php b/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/class-plugin.php index 161c3e090e..8a9dca01d8 100644 --- a/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/class-plugin.php +++ b/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/class-plugin.php @@ -67,6 +67,7 @@ private function __construct() { function plugins_loaded() { add_filter( 'gp_url_profile', array( $this, 'worg_profile_url' ), 10, 2 ); add_filter( 'gp_projects', array( $this, 'natural_sort_projects' ), 10, 2 ); + add_filter( 'gp_breadcrumb_items', array( $this, 'merge_directory_breadcrumbs' ), 5 ); add_action( 'gp_project_created', array( $this, 'update_projects_last_updated' ) ); add_action( 'gp_project_saved', array( $this, 'update_projects_last_updated' ) ); add_filter( 'pre_handle_404', array( $this, 'short_circuit_handle_404' ) ); @@ -758,6 +759,36 @@ public function worg_profile_url( $url, $nicename ) { return 'https://profiles.wordpress.org/' . $nicename . '/'; } + /** + * Merges the Plugins and Themes breadcrumbs into the project breadcrumb that follows them. + * + * The wp-plugins and wp-themes archives redirect to the homepage, so they shouldn't be linked. + * + * @param string[] $items Breadcrumb items as HTML strings. + * @return string[] Filtered breadcrumb items. + */ + public function merge_directory_breadcrumbs( $items ) { + $items = array_values( $items ); + + foreach ( $items as $index => $item ) { + if ( ! isset( $items[ $index + 1 ] ) ) { + break; + } + + foreach ( array( 'wp-plugins', 'wp-themes' ) as $path ) { + $url = esc_url( gp_url_project( $path ) ); + + // Only merge into a link to one of the directory's projects, not an action like "Edit". + if ( str_starts_with( $item, '