Ticket #6675: 6675.patch
| File 6675.patch, 4.3 KB (added by , 11 years ago) |
|---|
-
src/bp-core/bp-core-filters.php
diff --git src/bp-core/bp-core-filters.php src/bp-core/bp-core-filters.php index a351ac4..d8a54bf 100644
function bp_core_activation_signup_user_notification( $user, $user_email, $key, 646 646 add_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_notification', 1, 4 ); 647 647 648 648 /** 649 * Check what is the best filter to render the document title 650 * for BuddyPress pages 651 * 652 * @since 2.4.0 653 * 654 * @return string the appropriate filter 655 */ 656 function bp_do_document_title() { 657 $filter = 'wp_title'; 658 659 if ( function_exists( 'wp_get_document_title' ) ) { 660 $filter = 'document_title_parts'; 661 } 662 663 return $filter; 664 } 665 666 /** 649 667 * Filter the page title for BuddyPress pages. 650 668 * 651 669 * @since 1.5.0 … … function bp_modify_page_title( $title = '', $sep = '»', $seplocation = 'ri 790 808 791 809 // Append the site title to title parts if theme supports title tag 792 810 if ( true === $title_tag_compatibility ) { 793 $title_parts[ ] = $blogname;811 $title_parts['site'] = $blogname; 794 812 795 813 if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { 796 $title_parts[ ] = sprintf( __( 'Page %s', 'buddypress' ), max( $paged, $page ) );814 $title_parts['page'] = sprintf( __( 'Page %s', 'buddypress' ), max( $paged, $page ) ); 797 815 } 798 816 } 799 817 800 // Pad the separator with 1 space on each side 801 $prefix = str_pad( $sep, strlen( $sep ) + 2, ' ', STR_PAD_BOTH ); 818 if ( ! is_array( $title ) ) { 819 // Pad the separator with 1 space on each side 820 $prefix = str_pad( $sep, strlen( $sep ) + 2, ' ', STR_PAD_BOTH ); 802 821 803 // Join the parts together804 $new_title = join( $prefix, array_filter( $title_parts ) );822 // Join the parts together 823 $new_title = join( $prefix, array_filter( $title_parts ) ); 805 824 806 // Append the prefix for pre `title-tag` compatibility807 if ( false === $title_tag_compatibility ) {808 $new_title = $new_title . $prefix;809 }825 // Append the prefix for pre `title-tag` compatibility 826 if ( false === $title_tag_compatibility ) { 827 $new_title = $new_title . $prefix; 828 } 810 829 811 /** 812 * Filters the page title for BuddyPress pages. 813 * 814 * @since 1.5.0 815 * 816 * @param string $new_title The BuddyPress page title. 817 * @param string $title The original WordPress page title. 818 * @param string $sep The title parts separator. 819 * @param string $seplocation Location of the separator (left or right). 820 */ 821 return apply_filters( 'bp_modify_page_title', $new_title, $title, $sep, $seplocation ); 830 /** 831 * Filters the page title for BuddyPress pages. 832 * 833 * @since 1.5.0 834 * 835 * @param string $new_title The BuddyPress page title. 836 * @param string $title The original WordPress page title. 837 * @param string $sep The title parts separator. 838 * @param string $seplocation Location of the separator (left or right). 839 */ 840 return apply_filters( 'bp_modify_page_title', $new_title, $title, $sep, $seplocation ); 841 } else { 842 // Remove site & page to only keep the title of the viewed page 843 $bp_title_parts = array_diff_key( $title_parts, array( 'site' => false, 'page' => false ) ); 844 845 // Get the new separator 846 $sep = apply_filters( 'document_title_separator', '-' ); 847 848 // Build the new title, we don't need to sanitize it, as WordPress will take care of this. 849 $new_title = array( 'title' => join( " $sep ", $bp_title_parts ) ); 850 851 // Add the page argument if needed 852 if ( isset( $title_parts['page'] ) ) { 853 $new_title['page'] = $title_parts['page']; 854 } 855 856 // Add the site argument if needed 857 if ( isset( $title_parts['site'] ) ) { 858 $new_title['site'] = $title_parts['site']; 859 } 860 861 /** 862 * Filters the document title for BuddyPress pages. 863 * 864 * @since 2.4.0 865 * 866 * @param array $new_title The BuddyPress page title. 867 * @param array $title The original WordPress page title. 868 * @param string $sep The title separator 869 * @param array $title_parts The BuddyPress title parts 870 */ 871 return apply_filters( 'bp_modify_document_title', $new_title, $title, $sep, $title_parts ); 872 } 822 873 } 823 add_filter( 'wp_title', 'bp_modify_page_title', 20, 3 );874 add_filter( bp_do_document_title(), 'bp_modify_page_title', 20, 3 ); 824 875 add_filter( 'bp_modify_page_title', 'wptexturize' ); 825 876 add_filter( 'bp_modify_page_title', 'convert_chars' ); 826 877 add_filter( 'bp_modify_page_title', 'esc_html' );
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)