bp_get_blog_class( array $classes = array() )

Return the row class of the current blog in the loop.


Description Description


Parameters Parameters

$classes

(Optional) Array of custom classes.

Default value: array()


Top ↑

Return Return

(string) Row class of the site.


Top ↑

Source 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 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;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.