bbp_get_forum_class (intforum_id美元,美元的类=数组())
返回论坛的行类
描述
参数
- forum_id美元
-
(int)(可选)论坛ID
-
(数组)(可选)调用此函数时可以传递的额外类
返回
(字符串)排班的论坛
源
文件:bp-forums /论坛/ template.php
函数bbp_get_forum_class($forum_id = 0, $classes = array()) {$bbp = bbpress();$forum_id = bbp_get_forum_id($forum_id);$count = isset($bbp->forum_query->current_post) ?bbp - > forum_query - > current_post: 1;$classes = (array) $classes;//获取一些类$classes[] = 'loop-item-'。数美元;$classes[] = ((int) $count % 2) ?“甚至”:“奇怪”;$classes[] = bbp_is_forum_category($forum_id) ? 'status-category' : ''; $classes[] = bbp_get_forum_subforum_count( $forum_id ) ? 'bbp-has-subforums' : ''; $classes[] = bbp_get_forum_parent_id( $forum_id ) ? 'bbp-parent-forum-' . bbp_get_forum_parent_id( $forum_id ) : ''; $classes[] = 'bbp-forum-status-' . bbp_get_forum_status( $forum_id ); $classes[] = 'bbp-forum-visibility-' . bbp_get_forum_visibility( $forum_id ); // Ditch the empties $classes = array_filter( $classes ); $classes = get_post_class( $classes, $forum_id ); // Filter the results $classes = apply_filters( 'bbp_get_forum_class', $classes, $forum_id ); $retval = 'class="' . implode( ' ', $classes ) . '"'; return $retval; }
更新日志
版本 | 描述 |
---|---|
bbPress (r2667) | 介绍了。 |