diff --git src/bp-core/bp-core-filters.php src/bp-core/bp-core-filters.php
index 514acfa..43698d4 100644
|
|
add_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_not |
509 | 509 | * @param string $seplocation Direction to display title. |
510 | 510 | * @return string New page title. |
511 | 511 | */ |
512 | | function bp_modify_page_title( $title, $sep = '', $seplocation = '' ) { |
| 512 | function bp_modify_page_title( $title, $sep = '»', $seplocation = 'right' ) { |
513 | 513 | |
514 | 514 | // If this is not a BP page, just return the title produced by WP |
515 | 515 | if ( bp_is_blog_page() ) { |
… |
… |
function bp_modify_page_title( $title, $sep = '', $seplocation = '' ) { |
526 | 526 | return $title; |
527 | 527 | } |
528 | 528 | |
529 | | $bp = buddypress(); |
530 | | $title = ''; |
| 529 | $bp = buddypress(); |
| 530 | $title_parts = array(); |
531 | 531 | |
532 | 532 | // Displayed user |
533 | 533 | if ( bp_get_displayed_user_fullname() && ! is_404() ) { |
… |
… |
function bp_modify_page_title( $title, $sep = '', $seplocation = '' ) { |
566 | 566 | |
567 | 567 | // If on the user profile's landing page, just use the fullname |
568 | 568 | if ( bp_is_current_component( $bp->default_component ) && bp_get_requested_url() === bp_displayed_user_domain() ) { |
569 | | $title = bp_get_displayed_user_fullname(); |
| 569 | $title_parts[] = bp_get_displayed_user_fullname(); |
570 | 570 | |
571 | 571 | // Use component name on member pages |
572 | 572 | } else { |
| 573 | $title_parts = array_merge( $title_parts, array_map( 'strip_tags', array( |
| 574 | bp_get_displayed_user_fullname(), |
| 575 | $component_name, |
| 576 | ) ) ); |
| 577 | |
573 | 578 | // If we have a subnav name, add it separately for localization |
574 | 579 | if ( ! empty( $component_subnav_name ) ) { |
575 | | // translators: construct the page title. 1 = user name, 2 = component name, 3 = separator, 4 = component subnav name |
576 | | $title = strip_tags( sprintf( __( '%1$s %3$s %2$s %3$s %4$s', 'buddypress' ), bp_get_displayed_user_fullname(), $component_name, $sep, $component_subnav_name ) ); |
577 | | |
578 | | } else { |
579 | | // translators: construct the page title. 1 = user name, 2 = component name, 3 = separator |
580 | | $title = strip_tags( sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), bp_get_displayed_user_fullname(), $component_name, $sep ) ); |
| 580 | $title_parts[] = strip_tags( $component_subnav_name ); |
581 | 581 | } |
582 | 582 | } |
583 | 583 | |
584 | 584 | // A single group |
585 | 585 | } elseif ( bp_is_active( 'groups' ) && ! empty( $bp->groups->current_group ) && ! empty( $bp->bp_options_nav[ $bp->groups->current_group->slug ] ) ) { |
586 | 586 | $subnav = isset( $bp->bp_options_nav[ $bp->groups->current_group->slug ][ bp_current_action() ]['name'] ) ? $bp->bp_options_nav[ $bp->groups->current_group->slug ][ bp_current_action() ]['name'] : ''; |
587 | | // translators: 1 = group name, 2 = group nav section name, 3 = separator |
588 | | $title = sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), $bp->bp_options_title, $subnav, $sep ); |
| 587 | $title_parts = array( $bp->bp_options_title, $subnav ); |
589 | 588 | |
590 | 589 | // A single item from a component other than groups |
591 | 590 | } elseif ( bp_is_single_item() ) { |
592 | | // translators: 1 = component item name, 2 = component nav section name, 3 = separator |
593 | | $title = sprintf( __( '%1$s %3$s %2$s', 'buddypress' ), $bp->bp_options_title, $bp->bp_options_nav[ bp_current_item() ][ bp_current_action() ]['name'], $sep ); |
| 591 | $title_parts = array( $bp->bp_options_title, $bp->bp_options_nav[ bp_current_item() ][ bp_current_action() ]['name'] ); |
594 | 592 | |
595 | 593 | // An index or directory |
596 | 594 | } elseif ( bp_is_directory() ) { |
597 | 595 | $current_component = bp_current_component(); |
598 | 596 | |
599 | 597 | // No current component (when does this happen?) |
600 | | if ( empty( $current_component ) ) { |
601 | | $title = _x( 'Directory', 'component directory title', 'buddypress' ); |
602 | | } else { |
603 | | $title = bp_get_directory_title( $current_component ); |
| 598 | $title_parts = array( _x( 'Directory', 'component directory title', 'buddypress' ) ); |
| 599 | |
| 600 | if ( ! empty( $current_component ) ) { |
| 601 | $title_parts = array( bp_get_directory_title( $current_component ) ); |
604 | 602 | } |
605 | 603 | |
606 | 604 | // Sign up page |
607 | 605 | } elseif ( bp_is_register_page() ) { |
608 | | $title = __( 'Create an Account', 'buddypress' ); |
| 606 | $title_parts = array( __( 'Create an Account', 'buddypress' ) ); |
609 | 607 | |
610 | 608 | // Activation page |
611 | 609 | } elseif ( bp_is_activation_page() ) { |
612 | | $title = __( 'Activate your Account', 'buddypress' ); |
| 610 | $title_parts = array( __( 'Activate your Account', 'buddypress' ) ); |
613 | 611 | |
614 | 612 | // Group creation page |
615 | 613 | } elseif ( bp_is_group_create() ) { |
616 | | $title = __( 'Create a Group', 'buddypress' ); |
| 614 | $title_parts = array( __( 'Create a Group', 'buddypress' ) ); |
617 | 615 | |
618 | 616 | // Blog creation page |
619 | 617 | } elseif ( bp_is_create_blog() ) { |
620 | | $title = __( 'Create a Site', 'buddypress' ); |
| 618 | $title_parts = array( __( 'Create a Site', 'buddypress' ) ); |
621 | 619 | } |
622 | 620 | |
623 | 621 | // Some BP nav items contain item counts. Remove them |
624 | | $title = preg_replace( '|<span>[0-9]+</span>|', '', $title ); |
625 | | |
626 | | return apply_filters( 'bp_modify_page_title', $title . ' ' . $sep . ' ', $title, $sep, $seplocation ); |
| 622 | $title_parts = array_map( function( $t ) { |
| 623 | return preg_replace( '|<span>[0-9]+</span>|' , '', $t ); |
| 624 | }, $title_parts); |
| 625 | |
| 626 | // Append the site titl to title parts |
| 627 | $title_parts = array_merge( $title_parts, array( get_bloginfo( 'name', 'display' ) ) ); |
| 628 | |
| 629 | /** |
| 630 | * @param string the BuddyPress page title |
| 631 | * @param string $title the original WordPress page title |
| 632 | * @param string $sep the title parts separator |
| 633 | * @param string $seplocation Location of the separator (left or right). |
| 634 | */ |
| 635 | return apply_filters( 'bp_modify_page_title', join( ' ' . $sep . ' ', $title_parts ), $title, $sep, $seplocation ); |
627 | 636 | } |
628 | | add_filter( 'wp_title', 'bp_modify_page_title', 10, 3 ); |
| 637 | add_filter( 'wp_title', 'bp_modify_page_title', 20, 3 ); |
629 | 638 | add_filter( 'bp_modify_page_title', 'wptexturize' ); |
630 | 639 | add_filter( 'bp_modify_page_title', 'convert_chars' ); |
631 | 640 | add_filter( 'bp_modify_page_title', 'esc_html' ); |