bp_get_blog_class( array $classes = array() )
Return the row class of the current blog in the loop.
Description
Parameters
- $classes
-
(Optional) Array of custom classes.
Default value: array()
Return
(string) Row class of the site.
Source
File: bp-blogs/bp-blogs-template.php
function bp_get_blog_class( $classes = array() ) {
global $blogs_template;
// Add even/odd classes, but only if there's more than 1 group.
if ( $blogs_template->blog_count > 1 ) {
$pos_in_loop = (int) $blogs_template->current_blog;
$classes[] = ( $pos_in_loop % 2 ) ? 'even' : 'odd';
// If we've only one site in the loop, don't bother with odd and even.
} else {
$classes[] = 'bp-single-blog';
}
/**
* Filters the row class of the current blog in the loop.
*
* @since BuddyPress 1.7.0
*
* @param array $classes Array of classes to be applied to row.
*/
$classes = apply_filters( 'bp_get_blog_class', $classes );
$classes = array_merge( $classes, array() );
$retval = 'class="' . join( ' ', $classes ) . '"';
return $retval;
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 1.7.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.