Changeset 2926
- Timestamp:
- 02/20/2011 11:58:01 PM (14 years ago)
- Location:
- branches/plugin/bbp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-general-template.php
r2914 r2926 336 336 337 337 return false; 338 } 339 340 /** 341 * Use the above is_() functions to output a body class for each scenario 342 * 343 * @param array $wp_classes 344 * @param array $custom_classes 345 * 346 * @uses bbp_is_forum() 347 * @uses bbp_is_topic() 348 * @uses bbp_is_topic_edit() 349 * @uses bbp_is_topic_merge() 350 * @uses bbp_is_topic_split() 351 * @uses bbp_is_reply() 352 * @uses bbp_is_reply_edit() 353 * @uses bbp_is_reply_edit() 354 * @uses bbp_is_view() 355 * @uses bbp_is_user_profile_edit() 356 * @uses bbp_is_user_profile_page() 357 * @uses bbp_is_user_home() 358 * @uses bbp_is_subscriptions() 359 * @uses bbp_is_favorites() 360 * @uses bbp_is_topics_created() 361 * 362 * @return array 363 */ 364 function bbp_body_class( $wp_classes, $custom_classes = false ) { 365 366 $bbp_classes = array(); 367 368 /** Components ********************************************************/ 369 370 if ( bbp_is_forum() ) 371 $bbp_classes[] = bbp_get_forum_post_type(); 372 373 if ( bbp_is_topic() ) 374 $bbp_classes[] = bbp_get_topic_post_type(); 375 376 if ( bbp_is_topic_edit() ) 377 $bbp_classes[] = bbp_get_topic_post_type() . '-edit'; 378 379 if ( bbp_is_topic_merge() ) 380 $bbp_classes[] = bbp_get_topic_post_type() . '-merege'; 381 382 if ( bbp_is_topic_split() ) 383 $bbp_classes[] = bbp_get_topic_post_type() . '-split'; 384 385 if ( bbp_is_reply() ) 386 $bbp_classes[] = bbp_get_reply_post_type(); 387 388 if ( bbp_is_reply_edit() ) 389 $bbp_classes[] = bbp_get_reply_post_type() . '-edit'; 390 391 if ( bbp_is_view() ) 392 $bbp_classes[] = 'bbp-view'; 393 394 /** User **************************************************************/ 395 396 if ( bbp_is_user_profile_edit() ) 397 $bbp_classes[] = 'bbp-user-edit'; 398 399 if ( bbp_is_user_profile_page() ) 400 $bbp_classes[] = 'bbp-user-page'; 401 402 if ( bbp_is_user_home() ) 403 $bbp_classes[] = 'bbp-user-home'; 404 405 if ( bbp_is_topics_created() ) 406 $bbp_classes[] = 'bbp-topics-created'; 407 408 if ( bbp_is_favorites() ) 409 $bbp_classes[] = 'bbp-favorites'; 410 411 if ( bbp_is_subscriptions() ) 412 $bbp_classes[] = 'bbp-subscriptions'; 413 414 /** Clean up **********************************************************/ 415 416 // Add bbPress class if we are within a bbPress page 417 if ( !empty( $bbp_classes ) ) 418 $bbp_classes[] = 'bbPress'; 419 420 // Merge WP classes with bbPress classes 421 $classes = array_merge( (array) $bbp_classes, (array) $wp_classes ); 422 423 // Remove any duplicates 424 $classes = array_unique( $classes ); 425 426 return apply_filters( 'bbp_get_the_body_class', $classes, $bbp_classes, $wp_classes, $custom_classes ); 338 427 } 339 428 -
branches/plugin/bbp-includes/bbp-hooks.php
r2907 r2926 75 75 76 76 // Template - Head, foot, errors and notices 77 add_action( 'wp_head', 'bbp_head' ); 78 add_filter( 'wp_title', 'bbp_title', 10, 3 ); 79 add_action( 'wp_footer', 'bbp_footer' ); 80 add_action( 'bbp_template_notices', 'bbp_error_messages' ); 81 add_action( 'bbp_template_notices', 'bbp_topic_notices' ); 77 add_action( 'wp_head', 'bbp_head' ); 78 add_filter( 'wp_title', 'bbp_title', 10, 3 ); 79 add_action( 'wp_footer', 'bbp_footer' ); 80 add_action( 'bbp_template_notices', 'bbp_error_messages' ); 81 add_action( 'bbp_template_notices', 'bbp_topic_notices' ); 82 83 // Add to body class 84 add_filter( 'body_class', 'bbp_body_class', 10, 2 ); 82 85 83 86 // Caps & Roles
Note: See TracChangeset
for help on using the changeset viewer.