Skip to:
Content

bbPress.org

Changeset 7277

Timestamp:
07/02/2024 05:36:41 PM (6 weeks ago)
Author:
johnjamesjacoby
Message:

Breadcrumbs: prevent duplicate root crumb on Forum Archive subpages

This change prevents the Forum Archive page from appearing a second time in the breadcrumb trail when using pages, shortcodes, and/or subpages for forum setup.

It does this by keeping track of a previous match of a page by path to the Forum Archive, and skipping that page ID in the subsequent ancestors loop.

In trunk, for 2.7.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/common/template.php

    r7276 r7277  
    22632263
    22642264        // Define variables
    2265         $front_id         = $root_id                                 = 0;
     2265        $front_id         = $root_id                = 0;
    22662266        $ancestors        = $crumbs           = $tag_data            = array();
    22672267        $pre_root_text    = $pre_front_text   = $pre_current_text    = '';
     
    24182418            $page = bbp_get_page_by_path( bbp_get_root_slug() );
    24192419            if ( ! empty( $page ) ) {
    2420                 $root_url = get_permalink( $page->ID );
     2420                $root_url       = get_permalink( $page->ID );
     2421                $remove_root_id = $page->ID;
    24212422
    24222423            // Use the root slug
     
    24402441                // Skip parent if empty or error
    24412442                if ( empty( $parent ) || is_wp_error( $parent ) ) {
     2443
     2444
     2445
     2446
     2447
    24422448                    continue;
    24432449                }
Note: See TracChangeset for help on using the changeset viewer.