Ticket #2204: 2204.diff
File 2204.diff, 1.7 KB (added by , 10 years ago) |
---|
-
src/includes/common/template.php
1071 1071 } 1072 1072 1073 1073 /** 1074 * Output correct nav_menu classes if is_bbpress 1075 * 1076 * @since bbPress (r??) 1077 * 1078 * @param array $items 1079 * @uses is_bbpress() 1080 * @return array nav menu items 1081 */ 1082 function bbp_nav_menu_class( $items ) { 1083 if ( is_bbpress() ) { 1084 $parents = array(); 1085 foreach ( $items as $item ) { 1086 if ( strstr( $item->url, bbp_get_root_slug() ) ) { 1087 $item->classes[] = 'current-menu-item'; 1088 if ( $item->menu_item_parent && $item->menu_item_parent > 0 ) { 1089 $parents[] = $item->menu_item_parent; 1090 } 1091 } 1092 } 1093 foreach ( $items as $item ) { 1094 if ( in_array( $item->ID, $parents ) ) { 1095 $item->classes[] = 'current-menu-ancestor'; 1096 } 1097 } 1098 } 1099 return $items; 1100 } 1101 1102 /** 1074 1103 * Use the above is_() functions to return if in any bbPress page 1075 1104 * 1076 1105 * @since bbPress (r3344) -
src/includes/core/filters.php
41 41 add_filter( 'template_include', 'bbp_template_include', 10 ); 42 42 add_filter( 'wp_title', 'bbp_title', 10, 3 ); 43 43 add_filter( 'body_class', 'bbp_body_class', 10, 2 ); 44 add_filter( 'wp_nav_menu_objects', 'bbp_nav_menu_class', 10, 1 ); 44 45 add_filter( 'map_meta_cap', 'bbp_map_meta_caps', 10, 4 ); 45 46 add_filter( 'allowed_themes', 'bbp_allowed_themes', 10 ); 46 47 add_filter( 'redirect_canonical', 'bbp_redirect_canonical', 10 );