bbp_body_class(大堆wp_classes美元,大堆custom_classes美元=错误的)
使用上面的is_()函数为每个场景输出一个主体类
描述
参数
- wp_classes美元
-
(大堆)(必需的)
- custom_classes美元
-
(大堆)(可选的)
默认值:false
回来
(数组)身体课程
来源
文件:bp-forums /共同/ template.php
函数bbp_body_class($ wp_classes,$ custom_classes = false){$ bbp_classes = array();/ **档案***************************************************************** / if(bbp_is_forum_archive()){$ bbp_classes [] = bbp_get_forum_post_type()。'-档案';} elsef(bbp_is_topic_archive()){$ bbp_classes [] = bbp_get_topic_post_type()。'-档案';/ **主题标签************************************************************** /} elseif(bbp_is_topic_tag()){$ bbp_classes [] = bbp_get_topic_tag_tax_id();$ bbp_classes [] = bbp_get_topic_tag_tax_id()。' - '。 bbp_get_topic_tag_slug(); $bbp_classes[] = bbp_get_topic_tag_tax_id() . '-' . bbp_get_topic_tag_id(); } elseif ( bbp_is_topic_tag_edit() ) { $bbp_classes[] = bbp_get_topic_tag_tax_id() . '-edit'; $bbp_classes[] = bbp_get_topic_tag_tax_id() . '-' . bbp_get_topic_tag_slug() . '-edit'; $bbp_classes[] = bbp_get_topic_tag_tax_id() . '-' . bbp_get_topic_tag_id() . '-edit'; /** Components ************************************************************/ } elseif ( bbp_is_single_forum() ) { $bbp_classes[] = bbp_get_forum_post_type(); } elseif ( bbp_is_single_topic() ) { $bbp_classes[] = bbp_get_topic_post_type(); } elseif ( bbp_is_single_reply() ) { $bbp_classes[] = bbp_get_reply_post_type(); } elseif ( bbp_is_topic_edit() ) { $bbp_classes[] = bbp_get_topic_post_type() . '-edit'; } elseif ( bbp_is_topic_merge() ) { $bbp_classes[] = bbp_get_topic_post_type() . '-merge'; } elseif ( bbp_is_topic_split() ) { $bbp_classes[] = bbp_get_topic_post_type() . '-split'; } elseif ( bbp_is_reply_edit() ) { $bbp_classes[] = bbp_get_reply_post_type() . '-edit'; } elseif ( bbp_is_reply_move() ) { $bbp_classes[] = bbp_get_reply_post_type() . '-move'; } elseif ( bbp_is_single_view() ) { $bbp_classes[] = 'bbp-view'; /** User ******************************************************************/ } elseif ( bbp_is_single_user_edit() ) { $bbp_classes[] = 'bbp-user-edit'; $bbp_classes[] = 'single'; $bbp_classes[] = 'singular'; } elseif ( bbp_is_single_user() ) { $bbp_classes[] = 'bbp-user-page'; $bbp_classes[] = 'single'; $bbp_classes[] = 'singular'; } elseif ( bbp_is_user_home() ) { $bbp_classes[] = 'bbp-user-home'; $bbp_classes[] = 'single'; $bbp_classes[] = 'singular'; } elseif ( bbp_is_user_home_edit() ) { $bbp_classes[] = 'bbp-user-home-edit'; $bbp_classes[] = 'single'; $bbp_classes[] = 'singular'; } elseif ( bbp_is_topics_created() ) { $bbp_classes[] = 'bbp-topics-created'; $bbp_classes[] = 'single'; $bbp_classes[] = 'singular'; } elseif ( bbp_is_favorites() ) { $bbp_classes[] = 'bbp-favorites'; $bbp_classes[] = 'single'; $bbp_classes[] = 'singular'; } elseif ( bbp_is_subscriptions() ) { $bbp_classes[] = 'bbp-subscriptions'; $bbp_classes[] = 'single'; $bbp_classes[] = 'singular'; /** Search ****************************************************************/ } elseif ( bbp_is_search() ) { $bbp_classes[] = 'bbp-search'; $bbp_classes[] = 'forum-search'; } elseif ( bbp_is_search_results() ) { $bbp_classes[] = 'bbp-search-results'; $bbp_classes[] = 'forum-search-results'; } /** Clean up **************************************************************/ // Add Forums class if we are within a Forums page if ( !empty( $bbp_classes ) ) { $bbp_classes[] = 'bbpress'; } // Merge WP classes with Forums classes and remove any duplicates $classes = array_unique( array_merge( (array) $bbp_classes, (array) $wp_classes ) ); // Deprecated filter (do not use) $classes = apply_filters( 'bbp_get_the_body_class', $classes, $bbp_classes, $wp_classes, $custom_classes ); return apply_filters( 'bbp_body_class', $classes, $bbp_classes, $wp_classes, $custom_classes ); }
更新日志
版本 | 描述 |
---|---|
bbPress (r2926) | 介绍。 |