Changeset 6683 for trunk/src/includes/topics/template.php
- Timestamp:
- 09/09/2017 05:27:44 AM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/topics/template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/topics/template.php
r6682 r6683 2254 2254 */ 2255 2255 function bbp_get_topic_class( $topic_id = 0, $classes = array() ) { 2256 $bbp = bbpress(); 2257 $topic_id = bbp_get_topic_id( $topic_id ); 2258 $count = isset( $bbp->topic_query->current_post ) ? $bbp->topic_query->current_post : 1; 2259 $classes = (array) $classes; 2260 $classes[] = ( (int) $count % 2 ) ? 'even' : 'odd'; 2261 $classes[] = bbp_is_topic_sticky( $topic_id, false ) ? 'sticky' : ''; 2262 $classes[] = bbp_is_topic_super_sticky( $topic_id ) ? 'super-sticky' : ''; 2263 $classes[] = 'bbp-parent-forum-' . bbp_get_topic_forum_id( $topic_id ); 2264 $classes[] = 'user-id-' . bbp_get_topic_author_id( $topic_id ); 2265 $classes = array_filter( $classes ); 2266 $classes = get_post_class( $classes, $topic_id ); 2267 $classes = apply_filters( 'bbp_get_topic_class', $classes, $topic_id ); 2268 $retval = 'class="' . implode( ' ', $classes ) . '"'; 2269 2270 return $retval; 2256 $bbp = bbpress(); 2257 $topic_id = bbp_get_topic_id( $topic_id ); 2258 $classes = array_filter( (array) $classes ); 2259 $count = isset( $bbp->topic_query->current_post ) 2260 ? (int) $bbp->topic_query->current_post 2261 : 1; 2262 2263 // Get topic classes 2264 $topic_classes = array( 2265 'loop-item-' . $count, 2266 ( $count % 2 ) ? 'even' : 'odd', 2267 bbp_is_topic_sticky( $topic_id, false ) ? 'sticky' : '', 2268 bbp_is_topic_super_sticky( $topic_id ) ? 'super-sticky' : '', 2269 'bbp-parent-forum-' . bbp_get_topic_forum_id( $topic_id ), 2270 'user-id-' . bbp_get_topic_author_id( $topic_id ) 2271 ); 2272 2273 // Run the topic classes through the post-class filters, which also 2274 // handles the escaping of each individual class. 2275 $post_classes = get_post_class( array_merge( $classes, $topic_classes ), $topic_id ); 2276 2277 // Filter 2278 $new_classes = apply_filters( 'bbp_get_topic_class', $post_classes, $topic_id, $classes ); 2279 2280 // Return 2281 return 'class="' . implode( ' ', $new_classes ) . '"'; 2271 2282 } 2272 2283
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)