Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Forums index vs custom page shorturl

@regnalf

Participant

I don’t know how you excactly you want to style the forum index page, but i found out that the index page doesn’t have the bbpress class included in the body tag like the sub pages. So i had the problem too that i couldn’t style the index page.

Here is my code i use to add this class, and others, to the body tag for the index page. Then you can style the index page with css.

add_filter( 'body_class', 'bbpress_add_body_class' );
function bbpress_add_body_class( $classes )
{

	global $wp;

	$bbpress_index = get_option ('_bbp_root_slug');
	$bbpress_search = get_option ('_bbp_search_slug');
	

	if (strpos($wp->request, $bbpress_index) !== false)
	{
		$classes[] = "bbpress";		
	}

	if ($wp->request == $bbpress_index)
	{
		$classes[] = "bbpress-index";
	}

	if (strpos($wp->request, $bbpress_index . "/" . $bbpress_search) !== false)
	{
		$classes[] = "bbpress-search";		
	}
	

	return $classes;
	
}
Skip to toolbar