Making WordPress.org

Changeset 10345


Ignore:
Timestamp:
10/02/2020 07:39:42 AM (6 years ago)
Author:
dd32
Message:

bbPress & BuddyPress Codex: Add a crumb for the Search Results view, as otherwise the breadcrumb is based on the first search result and displays completely incorrectly with no results.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/buddypress.org/public_html/wp-content/themes/bb-base/functions-codex.php

    r10324 r10345  
    2121
    2222        if ( ! is_front_page() && ! is_page('home') && ! is_404() ) {
    23 
    24                 $crumb[] = '→ ' . get_the_title( $post->ID );
    25 
    26                 if ( !empty( $post->ancestors ) ) {
    27                         foreach ( $post->ancestors as $post_id ) {
    28                                 $crumb[] = '&rarr; <a href="' . get_permalink( $post_id ) . '">' . get_the_title( $post_id ) . '</a>';
     23                if ( is_singular() ) {
     24                        $crumb[] = get_the_title( $post->ID );
     25
     26                        if ( ! empty( $post->ancestors ) ) {
     27                                foreach ( $post->ancestors as $post_id ) {
     28                                        $crumb[] = '<a href="' . get_permalink( $post_id ) . '">' . get_the_title( $post_id ) . '</a>';
     29                                }
    2930                        }
     31                } elseif ( is_search() ) {
     32                        $crumb[] = esc_html( get_search_query( false ) );
     33                        $crumb[] = __( 'Search Results', 'bborg' );
    3034                }
    3135
     
    3337
    3438                krsort( $crumb );
    35                 $crumb = implode( ' ', $crumb );
     39                $crumb = implode( ' &rarr; ', $crumb );
    3640                echo $crumb;
    3741        }
Note: See TracChangeset for help on using the changeset viewer.