Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to change <title> tags order?


  • davelr1
    Participant

    @davelr1

    Hi!

    I would like to change the <title> tags order at the single reply page.

    My current title tags shows up like this: Group Name – Forum – Topic Title – Website Name

    and I want to display the title like this: Topic Title – Group Name – Forum – Website Name
    (or just the Topic Title is fine)

    Does anybody know how to do that?

    Thanks in advance 🙂

Viewing 1 replies (of 1 total)

  • danbp
    Participant

    @danbp

    This question is related to bbPress.
    See bbp_title filter in wp-content/plugins/bbpress/includes/common/template.php:2519
    Similar technique is used by BuddyPress.
    See function bp_modify_page_title in bp-core-filsters.php:514

    Here a usage example to uppercase BP titles.

    function bpfr_profiles_wp_title( $title ='', $sep = '', $seplocation = '' ) {
    	if( bp_get_displayed_user_fullname() ) {
    	$bp = buddypress();
    	
    	// Get the component's ID to try and get it's name
    	$component_id = $component_name = bp_current_component();
    	
    	// Use the actual component name
    	if ( !empty( $bp->{$component_id}->name ) ) {
    	$component_name = $bp->{$component_id}->name;
    	
    	// Fall back on the component ID (probably same as current_component)
    } elseif ( !empty( $bp->{$component_id}->id ) ) {
    	$component_name = $bp->{$component_id}->id;
    	}
    	
    	$title = str_replace( ucwords( $component_name ), '', $title );
    	}  
    	return $title;
    	}
    add_filter( 'bp_modify_page_title', 'bpfr_profiles_wp_title', 20, 3 );
Viewing 1 replies (of 1 total)
  • The topic ‘How to change <title> tags order?’ is closed to new replies.
Skip to toolbar