bb_get_title

The BuddyPress bb get title function.

Description

bb_get_title( (string) $args = '' ); 

Parameters (1)

0. $args — Optional. (string) => ''
The args.

Usage

  1. if ( !function_exists( 'bb_get_title' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-template.php'; 
  3.  
  4. // The args. 
  5. $args = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_get_title($args); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-includes/functions.bb-template.php  
  1. function bb_get_title( $args = '' ) { 
  2. $defaults = array( 
  3. 'separator' => ' « ',  
  4. 'order' => 'normal',  
  5. 'front' => '' 
  6. ); 
  7. $args = wp_parse_args( $args, $defaults ); 
  8. $title = array(); 
  9.  
  10. switch ( bb_get_location() ) { 
  11. case 'search-page': 
  12. if ( !$q = trim( @$_GET['search'] ) ) 
  13. if ( !$q = trim( @$_GET['q'] ) ) 
  14. break; 
  15. $title[] = sprintf( __( 'Search for %s' ), esc_html( $q ) ); 
  16. break; 
  17. case 'front-page': 
  18. if ( !empty( $args['front'] ) ) 
  19. $title[] = $args['front']; 
  20. break; 
  21.  
  22. case 'topic-edit-page': 
  23. case 'topic-page': 
  24. $title[] = get_topic_title(); 
  25. break; 
  26.  
  27. case 'forum-page': 
  28. $title[] = get_forum_name(); 
  29. break; 
  30.  
  31. case 'tag-page': 
  32. if ( bb_is_tag() ) 
  33. $title[] = esc_html( bb_get_tag_name() ); 
  34.  
  35. $title[] = __( 'Tags' ); 
  36. break; 
  37.  
  38. case 'profile-page': 
  39. $title[] = get_user_display_name(); 
  40. break; 
  41.  
  42. case 'view-page': 
  43. $title[] = get_view_name(); 
  44. break; 
  45.  
  46. if ( $st = bb_get_option( 'static_title' ) ) 
  47. $title = array( $st ); 
  48.  
  49. $title[] = bb_get_option( 'name' ); 
  50.  
  51. if ( 'reversed' == $args['order'] ) 
  52. $title = array_reverse( $title ); 
  53.  
  54. return apply_filters( 'bb_get_title', implode( $args['separator'], $title ), $args, $title );