bbp_get_topic_class (inttopic_id美元,美元的类=数组())
返回主题的行类
描述
参数
- topic_id美元
-
(int)(可选)主题id
-
(数组)(可选)调用此函数时可以传递的额外类
返回
(字符串)一个主题的行类
源
文件:bp-forums /主题/ template.php
函数bbp_get_topic_class($topic_id = 0, $classes = array()) {$bbp = bbpress();$topic_id = bbp_get_topic_id($topic_id);$count = isset($bbp->topic_query->current_post) ?bbp - > topic_query - > current_post: 1;$classes = (array) $classes;$classes[] = ((int) $count % 2) ?“甚至”:“奇怪”;$classes[] = bbp_is_topic_sticky($topic_id, false) ?“粘”:”;$classes[] = bbp_is_topic_super_sticky($topic_id) ? 'super-sticky' : ''; $classes[] = 'bbp-parent-forum-' . bbp_get_topic_forum_id( $topic_id ); $classes[] = 'user-id-' . bbp_get_topic_author_id( $topic_id ); $classes = array_filter( $classes ); $classes = get_post_class( $classes, $topic_id ); $classes = apply_filters( 'bbp_get_topic_class', $classes, $topic_id ); $retval = 'class="' . implode( ' ', $classes ) . '"'; return $retval; }
更新日志
版本 | 描述 |
---|---|
bbPress (r2667) | 介绍了。 |