Ticket #769: template-functions.php.diff

File template-functions.php.diff, 2.0 KB (added by rmccue, 4 years ago)

Patch to add features to trunk

  • template-functions.php

     
    284284        return 'stats-page' == bb_get_location(); 
    285285} 
    286286 
    287 function bb_title() { 
    288         echo apply_filters( 'bb_title', bb_get_title() ); 
     287function bb_title( $args = '' ) { 
     288        echo apply_filters( 'bb_title', bb_get_title( $args ) ); 
    289289} 
    290290 
    291 function bb_get_title() { 
     291function bb_get_title( $args = '' ) { 
     292        $defaults = array( 'separator' => ' « ', 'title' => 'first', 'front' => '' ); 
     293        $args = wp_parse_args( $args, $defaults ); 
    292294        $title = ''; 
    293         if ( is_topic() ) 
    294                 $title = get_topic_title(). ' « '; 
     295        if ( 'last' == $args['title'] ) 
     296                $title .= bb_get_option( 'name' ) . ( ( !is_front() || !empty( $args['front'] ) ) ? $args['separator'] : '' ); 
     297        if ( is_front() && !empty( $args['front'] ) ) 
     298                $title .= $args['front']; 
     299        elseif ( is_topic() ) 
     300                $title .= get_topic_title(); 
    295301        elseif ( is_forum() ) 
    296                 $title = get_forum_name() . ' « '; 
    297         elseif ( is_bb_tags() ) 
    298                 $title = ( is_bb_tag() ? wp_specialchars( bb_get_tag_name() ) . ' « ' : '' ) . __('Tags') . ' « '; 
     302                $title .= get_forum_name(); 
     303        elseif ( is_bb_tags() ) { 
     304                if ( 'last' == $args['title'] ) 
     305                        $title .= __('Tags')  . $args['separator']; 
     306                $title .= ( is_bb_tag() ? wp_specialchars( bb_get_tag_name() ) : '' ); 
     307                if ( 'last' != $args['title'] ) 
     308                        $title .= $args['separator'] . __('Tags'); 
     309        } 
    299310        elseif ( is_bb_profile() ) 
    300                 $title = get_user_name() . ' « '; 
     311                $title .= get_user_name(); 
    301312        elseif ( is_view() ) 
    302                 $title = get_view_name() . ' « '; 
     313                $title .= get_view_name(); 
    303314        if ( $st = bb_get_option( 'static_title' ) ) 
    304                 $title = $st; 
    305         $title .= bb_get_option( 'name' ); 
     315                $title .= $st; 
     316        if ( 'first' == $args['title'] ) 
     317                $title .= ( ( !is_front() || !empty( $args['front'] ) ) ? $args['separator'] : '' ) . bb_get_option( 'name' ); 
    306318        return apply_filters( 'bb_get_title', $title ); 
    307319} 
    308320