Making WordPress.org


Ignore:
Timestamp:
01/26/2023 04:23:09 PM (2 years ago)
Author:
ryelle
Message:

Support Forums: Update links in breadcrumb and header.

Update the home links in breadcrumbs and header bar to link to the forums landing page. Also updates the Documentation link to the new w.org/documentation URL.

Props zoonini.
Fixes #6704.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php

    r12321 r12369  
    175175}
    176176add_filter( 'bbp_before_get_breadcrumb_parse_args', 'wporg_support_breadcrumb' );
     177
     178add_filter(
     179    'bbp_breadcrumbs',
     180    /**
     181     * Filters the breadcrumbs to replace the home URL with the forums page.
     182     */
     183    function( $crumbs ) {
     184        foreach ( $crumbs as $i => $link ) {
     185            if ( str_contains( $link, 'bbp-breadcrumb-home' ) ) {
     186                $crumbs[ $i ] = str_replace( home_url(), home_url( '/forums/' ), $link );
     187            }
     188        }
     189        return $crumbs;
     190    },
     191    10,
     192    2
     193);
    177194
    178195/**
Note: See TracChangeset for help on using the changeset viewer.