Skip to:
Content
Pages
Categories
Search
Top
Bottom

Can't change forum's index meta title


  • saulmarq
    Participant

    @saulmarq

    Hello. This plugin has given me just about everything I need thus far. However, I want to change the meta title on my forum’s index page to something along the lines of:

    YA Book Forum | 7th Page Community

    However, right now it only says “Forums”

    This only applies to the front page/index page of the forums. The other pages in the forums display the specific forum/topic’s titles and that’s perfect. But how do I change “Forums” to a custom title?

    I changed the name of the page that the forums are on to YA Book Forum and while that changed the title on the top, it didn’t change the meta title. I also tried to customize the meta title with my SEO plugin but that didn’t work either. I even went in and edited the template’s header and it still came up as “Forums.”

    Anyway to fix this?

    My forum is at: http://www.7thpage.com/forums/

    Thank you!

Viewing 9 replies - 1 through 9 (of 9 total)

  • Robin W
    Moderator

    @robin-w

    I think I understand

    go into dashboard>settings>forums and change the slugs for forum root and single forum root. that will change the url

    If you want to change the breadcrumb, then see

    Layout and functionality – Examples you can use

    you can also set

    ‘home_text’ , ‘root_text’ and ‘current_text’

    using this code

    If that’s not what you are after – come back !


    saulmarq
    Participant

    @saulmarq

    Hi, thanks so much for taking the time to help.

    I should have been more clear because that’s not what I was looking for. 🙂

    Also, I’ve since changed the address of my forum: http://www.7thpage.com/community/

    So this is how it’s setup:
    Forum Slug is set to Community and I have created a page called Community. After I made the page called Community, I renamed the title to YA Book Forum. So now it’s a page with the permalink http://www.7thpage.com/community/ but titled YA Book Forum. The title YA Book Forum appears as the title at the top of the page–so that’s all good.

    However, the title in the browser’s tab/window still says Forums. When you view the page’s source, you’ll see that the title’s tag is: <title>Forums</title>

    I want the name YA Book Forum to appear there, not Forums.

    I hope that makes more sense? It’s showing up in the browser’s tab. Thanks!


    Robin W
    Moderator

    @robin-w

    ok, I can see that – don’t know how you would fix – sorry ! Hopefully someone who can will be along


    Robin W
    Moderator

    @robin-w

    ok, the answer is somewhere in this function

    function bbp_title( $title = '', $sep = '&raquo;', $seplocation = '' ) {
    
    	// Title array
    	$new_title = array();
    
    	/** Archives **************************************************************/
    
    	// Forum Archive
    	if ( bbp_is_forum_archive() ) {
    		$new_title['text'] = bbp_get_forum_archive_title();
    
    	// Topic Archive
    	} elseif ( bbp_is_topic_archive() ) {
    		$new_title['text'] = bbp_get_topic_archive_title();
    
    	/** Edit ******************************************************************/
    
    	// Forum edit page
    	} elseif ( bbp_is_forum_edit() ) {
    		$new_title['text']   = bbp_get_forum_title();
    		$new_title['format'] = esc_attr__( 'Forum Edit: %s', 'bbpress' );
    
    	// Topic edit page
    	} elseif ( bbp_is_topic_edit() ) {
    		$new_title['text']   = bbp_get_topic_title();
    		$new_title['format'] = esc_attr__( 'Topic Edit: %s', 'bbpress' );
    
    	// Reply edit page
    	} elseif ( bbp_is_reply_edit() ) {
    		$new_title['text']   = bbp_get_reply_title();
    		$new_title['format'] = esc_attr__( 'Reply Edit: %s', 'bbpress' );
    
    	// Topic tag edit page
    	} elseif ( bbp_is_topic_tag_edit() ) {
    		$new_title['text']   = bbp_get_topic_tag_name();
    		$new_title['format'] = esc_attr__( 'Topic Tag Edit: %s', 'bbpress' );
    
    	/** Singles ***************************************************************/
    
    	// Forum page
    	} elseif ( bbp_is_single_forum() ) {
    		$new_title['text']   = bbp_get_forum_title();
    		$new_title['format'] = esc_attr__( 'Forum: %s', 'bbpress' );
    
    	// Topic page
    	} elseif ( bbp_is_single_topic() ) {
    		$new_title['text']   = bbp_get_topic_title();
    		$new_title['format'] = esc_attr__( 'Topic: %s', 'bbpress' );
    
    	// Replies
    	} elseif ( bbp_is_single_reply() ) {
    		$new_title['text']   = bbp_get_reply_title();
    
    	// Topic tag page
    	} elseif ( bbp_is_topic_tag() || get_query_var( 'bbp_topic_tag' ) ) {
    		$new_title['text']   = bbp_get_topic_tag_name();
    		$new_title['format'] = esc_attr__( 'Topic Tag: %s', 'bbpress' );
    
    	/** Users *****************************************************************/
    
    	// Profile page
    	} elseif ( bbp_is_single_user() ) {
    
    		// User is viewing their own profile
    		if ( bbp_is_user_home() ) {
    			$new_title['text'] = esc_attr_x( 'Your', 'User viewing his/her own profile', 'bbpress' );
    
    		// User is viewing someone else's profile (so use their display name)
    		} else {
    			$new_title['text'] = sprintf( esc_attr_x( "%s's", 'User viewing another users profile', 'bbpress' ), get_userdata( bbp_get_user_id() )->display_name );
    		}
    
    		// User topics created
    		if ( bbp_is_single_user_topics() ) {
    			$new_title['format'] = esc_attr__( "%s Topics",        'bbpress' );
    
    		// User rueplies created
    		} elseif ( bbp_is_single_user_replies() ) {
    			$new_title['format'] = esc_attr__( "%s Replies",       'bbpress' );
    
    		// User favorites
    		} elseif ( bbp_is_favorites() ) {
    			$new_title['format'] = esc_attr__( "%s Favorites",     'bbpress' );
    
    		// User subscriptions
    		} elseif ( bbp_is_subscriptions() ) {
    			$new_title['format'] = esc_attr__( "%s Subscriptions", 'bbpress' );
    
    		// User "home"
    		} else {
    			$new_title['format'] = esc_attr__( "%s Profile",       'bbpress' );
    		}
    
    	// Profile edit page
    	} elseif ( bbp_is_single_user_edit() ) {
    
    		// Current user
    		if ( bbp_is_user_home_edit() ) {
    			$new_title['text']   = esc_attr__( 'Edit Your Profile', 'bbpress' );
    
    		// Other user
    		} else {
    			$new_title['text']   = get_userdata( bbp_get_user_id() )->display_name;
    			$new_title['format'] = esc_attr__( "Edit %s's Profile", 'bbpress' );
    		}
    
    	/** Views *****************************************************************/
    
    	// Views
    	} elseif ( bbp_is_single_view() ) {
    		$new_title['text']   = bbp_get_view_title();
    		$new_title['format'] = esc_attr__( 'View: %s', 'bbpress' );
    
    	/** Search ****************************************************************/
    
    	// Search
    	} elseif ( bbp_is_search() ) {
    		$new_title['text'] = bbp_get_search_title();
    	}
    
    	// This filter is deprecated. Use 'bbp_before_title_parse_args' instead.
    	$new_title = apply_filters( 'bbp_raw_title_array', $new_title );
    
    	// Set title array defaults
    	$new_title = bbp_parse_args( $new_title, array(
    		'text'   => $title,
    		'format' => '%s'
    	), 'title' );
    
    	// Get the formatted raw title
    	$new_title = sprintf( $new_title['format'], $new_title['text'] );
    
    	// Filter the raw title
    	$new_title = apply_filters( 'bbp_raw_title', $new_title, $sep, $seplocation );
    
    	// Compare new title with original title
    	if ( $new_title === $title )
    		return $title;
    
    	// Temporary separator, for accurate flipping, if necessary
    	$t_sep  = '%WP_TITILE_SEP%';
    	$prefix = '';
    
    	if ( !empty( $new_title ) )
    		$prefix = " $sep ";
    
    	// sep on right, so reverse the order
    	if ( 'right' === $seplocation ) {
    		$new_title_array = array_reverse( explode( $t_sep, $new_title ) );
    		$new_title       = implode( " $sep ", $new_title_array ) . $prefix;
    
    	// sep on left, do not reverse
    	} else {
    		$new_title_array = explode( $t_sep, $new_title );
    		$new_title       = $prefix . implode( " $sep ", $new_title_array );
    	}
    
    	// Filter and return
    	return apply_filters( 'bbp_title', $new_title, $sep, $seplocation );
    }
    

    a filter such as

    function amend_title () {
    	if ( bbp_is_single_forum() ) {
    		$new_title['text']   = 'YA book forum' ;
    		$new_title['format'] = esc_attr__( 'YA book Forum', 'bbpress' );
    		}
     return $new_title;
    }
    add_filter('bbp_before_title_parse_args', 'amend_title' );
    

    should sort it but doesn’t, and I’m too tired to work out why 🙂

    Over to you !


    tharsheblows
    Participant

    @tharsheblows

    @robinw – I just came across this too and thought exactly the same as you, that it needed that filter or something like that. I was trying to change the “Topic tags: ” (or something like that) bit of the tags archive pages.

    It was picking up the default taxonomy-topic-tags.php file. This must have been picked up from the plugin default theme, not mine – it’s in /extras in my theme folder but changing it there had no effect, I had to move it out of there to the root of the theme folder. This totally makes sense from a WordPress standpoint but was non-obvious because I was looking in the bbPress folder in my theme.

    ANYWAY it’s sorted now but if someone else comes across it, check for some hidden template. I couldn’t get that filter to work for anything. I tried very very hard to make it work. It didn’t.

    @saulmarq – what you can do is make a new page and make the permalink your forum root. So my forum root (in settings) is forums and the page is at example.com/forums. Then use the [bbp-forum-index] shortcode. The gotcha is that this page will *only* use the bbPress template, I think – you can’t make a custom template for it. I might be misremembering that, but I do know you can’t change the default template. Someone tried to tell me this was a good thing, whatever.

    Doing it this way is nice because then you can write an intro like:

    Hi! Welcome to our forums. Dive right in. Post a lot, whoo!

    [bbp-forum-index]


    tharsheblows
    Participant

    @tharsheblows

    @saulmarq – I didn’t read your second post and completely misunderstood. I use Yoast SEO and set the page title there.


    ernstl
    Participant

    @ernstl

    Hi Folks,

    i came across the same problem. To prevent bbpress adding a prefix ala “Forum: lalala” to the meta title do this:

    function my_generate_titles( $new_title ){
            // reset the format to title only
    	$new_title['format'] = '%s';
    	return $new_title;
    
    }
    add_filter( 'bbp_before_title_parse_args', 'my_generate_titles' );

    @saulmarq you can query your title data within the function and set the $new_title[‘text’] var with the value you want to display

    Rgds from Germany,
    ernstl


    Cagatay Belgen
    Participant

    @belgen

    in terms of programming (considering it is almost year 2015 and how important SEO is), lacking a proper method of adding/editing title of main forum page is a disaster.


    Bimbrownik
    Participant

    @bimbrownik

    Thanks ernst – prefix deleted.
    Now another problem . To the title of each post is added at the end of the name of the blog. How to delete this part ? To remain only the title of the post without additives.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.
Skip to toolbar