Changeset 4536
- Timestamp:
- 06/19/2011 05:29:51 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-filters.php
r4325 r4536 252 252 add_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_notification', 1, 4 ); 253 253 254 /** 255 * Filter the page title for BuddyPress pages 256 * 257 * @global object $bp BuddyPress global settings 258 * @global unknown $post 259 * @global WP_Query $wp_query WordPress query object 260 * @param string $title Original page title 261 * @param string $sep How to separate the various items within the page title. 262 * @param string $seplocation Direction to display title 263 * @return string new page title 264 * @see wp_title() 265 * @since 1.3 266 */ 267 function bp_modify_page_title( $title, $sep, $seplocation ) { 268 global $bp, $post, $wp_query; 269 270 if ( bp_is_blog_page() ) 271 return $title; 272 273 $title = ''; 274 275 // Displayed user 276 if ( !empty( $bp->displayed_user->fullname ) && !is_404() ) { 277 // translators: "displayed user's name | canonicalised component name" 278 $title = strip_tags( sprintf( __( '%1$s | %2$s', 'buddypress' ), bp_get_displayed_user_fullname(), ucwords( bp_current_component() ) ) ); 279 280 // A single group 281 } elseif ( bp_is_active( 'groups' ) && !empty( $bp->groups->current_group ) && !empty( $bp->bp_options_nav[$bp->groups->current_group->slug] ) ) { 282 $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'] : ''; 283 // translators: "group name | group nav section name" 284 $title = sprintf( __( '%1$s | %2$s', 'buddypress' ), $bp->bp_options_title, $subnav ); 285 286 // A single item from a component other than groups 287 } elseif ( bp_is_single_item() ) { 288 // translators: "root component name | component item name | component nav section name" 289 $title = sprintf( __( '%1$s | %2$s | %3$s', 'buddypress' ), bp_get_name_from_root_slug(), $bp->bp_options_title, $bp->bp_options_nav[$bp->current_component][$bp->current_action]['name'] ); 290 291 // An index or directory 292 } elseif ( bp_is_directory() ) { 293 if ( !bp_current_component() ) 294 $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug( $bp->members->slug ) ); 295 else 296 $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug() ); 297 298 // Sign up page 299 } elseif ( bp_is_register_page() ) { 300 $title = __( 'Create an Account', 'buddypress' ); 301 302 // Activation page 303 } elseif ( bp_is_activation_page() ) { 304 $title = __( 'Activate your Account', 'buddypress' ); 305 306 // Group creation page 307 } elseif ( bp_is_group_create() ) { 308 $title = __( 'Create a Group', 'buddypress' ); 309 310 // Blog creation page 311 } elseif ( bp_is_create_blog() ) { 312 $title = __( 'Create a Site', 'buddypress' ); 313 } 314 315 return apply_filters( 'bp_modify_page_title', $title . " $sep ", $title, $sep, $seplocation ); 316 } 317 add_filter( 'wp_title', 'bp_modify_page_title', 10, 3 ); 318 add_filter( 'bp_modify_page_title', 'wptexturize' ); 319 add_filter( 'bp_modify_page_title', 'convert_chars' ); 320 add_filter( 'bp_modify_page_title', 'esc_html' ); 254 321 ?> -
trunk/bp-core/bp-core-template.php
r4532 r4536 212 212 function bp_get_plugin_sidebar() { 213 213 locate_template( array( 'plugin-sidebar.php' ), true ); 214 }215 216 function bp_page_title() {217 echo bp_get_page_title();218 }219 220 function bp_get_page_title() {221 global $bp, $post, $wp_query;222 223 $title = '';224 225 // Home226 if ( is_front_page() || ( is_home() && bp_is_page( 'home' ) ) ) {227 $title = _x( 'Home', 'Home page title', 'buddypress' );228 229 // Blog230 } elseif ( bp_is_blog_page() ) {231 if ( is_single() ) {232 $title = sprintf( __( 'Site | %s', 'buddypress' ), $post->post_title );233 } else if ( is_category() ) {234 $title = sprintf( __( 'Site | Categories | %s', 'buddypress' ), ucwords( $wp_query->query_vars['category_name'] ) );235 } else if ( is_tag() ) {236 $title = sprintf( __( 'Site | Tags | %s', 'buddypress' ), ucwords( $wp_query->query_vars['tag'] ) );237 } else if ( is_page() ){238 $title = $post->post_title;239 } else240 $title = __( 'Site', 'buddypress' );241 242 // Displayed user243 } elseif ( !empty( $bp->displayed_user->fullname ) && !is_404() ) {244 // translators: "displayed user's name | canonicalised component name"245 $title = strip_tags( sprintf( __( '%1$s | %2$s', 'buddypress' ), $bp->displayed_user->fullname, ucwords( bp_current_component() ) ) );246 247 // A single group248 } elseif ( bp_is_active( 'groups' ) && !empty( $bp->groups->current_group ) && !empty( $bp->bp_options_nav[$bp->groups->current_group->slug] ) ) {249 $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'] : '';250 // translators: "group name | group nav section name"251 $title = sprintf( __( '%1$s | %2$s', 'buddypress' ), $bp->bp_options_title, $subnav );252 253 // A single item from a component other than groups254 } elseif ( bp_is_single_item() ) {255 // translators: "root component name | component item name | component nav section name"256 $title = sprintf( __( '%1$s | %2$s | %3$s', 'buddypress' ), bp_get_name_from_root_slug(), $bp->bp_options_title, $bp->bp_options_nav[$bp->current_component][$bp->current_action]['name'] );257 258 // An index or directory259 } elseif ( bp_is_directory() ) {260 if ( !bp_current_component() )261 $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug( $bp->members->slug ) );262 else263 $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug() );264 265 // Sign up page266 } elseif ( bp_is_register_page() ) {267 $title = __( 'Create an Account', 'buddypress' );268 269 // Activation page270 } elseif ( bp_is_activation_page() ) {271 $title = __( 'Activate your Account', 'buddypress' );272 273 // Group creation page274 } elseif ( bp_is_group_create() ) {275 $title = __( 'Create a Group', 'buddypress' );276 277 // Blog creation page278 } elseif ( bp_is_create_blog() ) {279 $title = __( 'Create a Site', 'buddypress' );280 }281 282 $site_title = get_bloginfo( 'name', 'display' );283 284 // Filter the title285 if ( !empty( $title ) )286 $site_title .= ' | ' . $title;287 288 return apply_filters( 'bp_page_title', esc_attr( $site_title ), esc_attr( $site_title ) );289 }290 291 function bp_styles() {292 do_action( 'bp_styles' );293 wp_print_styles();294 214 } 295 215 -
trunk/bp-core/deprecated/1.3.php
r4532 r4536 383 383 } 384 384 385 /** 386 * Template tag version of bp_get_page_title() 387 * 388 * @deprecated 1.3 389 * @deprecated Use wp_title() 390 * @since 1.0 391 */ 392 function bp_page_title() { 393 echo bp_get_page_title(); 394 } 395 /** 396 * Prior to BuddyPress 1.3, this was used to generate the page's <title> text. 397 * Now, just simply use wp_title(). 398 * 399 * @deprecated 1.3 400 * @deprecated Use wp_title() 401 * @since 1.0 402 */ 403 function bp_get_page_title() { 404 _deprecated_function( __FUNCTION__, '1.3', 'wp_title()' ); 405 $title = wp_title( '|', false, 'right' ) . get_bloginfo( 'name', 'display' ); 406 407 // Backpat for BP 1.2 filter 408 $title = apply_filters( 'bp_page_title', esc_attr( $title ), esc_attr( $title ) ); 409 410 return apply_filters( 'bp_get_page_title', $title ); 411 } 412 413 function bp_styles() { 414 do_action( 'bp_styles' ); 415 wp_print_styles(); 416 } 385 417 386 418 /** Theme *********************************************************************/ -
trunk/bp-forums/bp-forums-filters.php
r4301 r4536 95 95 * 96 96 * @global object $bp 97 * @param string $title 97 * @param string $title New page title; see bp_modify_page_title() 98 * @param string $title Original page title 99 * @param string $sep How to separate the various items within the page title. 100 * @param string $seplocation Direction to display title 98 101 * @return string 99 */ 100 function bp_forums_add_forum_topic_to_page_title( $title ) { 102 * @see bp_modify_page_title() 103 */ 104 function bp_forums_add_forum_topic_to_page_title( $title, $original_title, $sep, $seplocation ) { 101 105 global $bp; 102 106 103 107 if ( $bp->current_action == 'forum' && !empty( $bp->action_variables[0] ) && 'topic' == $bp->action_variables[0] ) 104 108 if ( bp_has_forum_topic_posts() ) 105 $title .= ' | ' . bp_get_the_topic_title();109 $title .= bp_get_the_topic_title() . " $sep "; 106 110 107 111 return $title; 108 112 } 109 add_filter( 'bp_ page_title', 'bp_forums_add_forum_topic_to_page_title');113 add_filter( 'bp_modify_page_title', 'bp_forums_add_forum_topic_to_page_title', 9, 4 ); 110 114 111 115 /** -
trunk/bp-themes/bp-default/header.php
r4532 r4536 4 4 <head profile="http://gmpg.org/xfn/11"> 5 5 <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ) ?>; charset=<?php bloginfo( 'charset' ) ?>" /> 6 <title><?php bp_page_title()?></title>6 <title><?php wp_title( '|', true, 'right' ); bloginfo( 'name' ); ?></title> 7 7 <link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url') ?>" type="text/css" media="screen" /> 8 8
Note: See TracChangeset
for help on using the changeset viewer.