Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: [Resolved] Group specific classes in activity stream posts

@danbp

Participant

hi @fumow,

here is a way to color any group activity on the site activity.
Group A is red, Group B is green.

The function use the group ID and add a class to the existing. You can modify it in your child theme style.css file

Function can be installed in functions.php or bp-custom.php

function fumow_li_class_group_id( $class = '' ) {
	global $activities_template;
	
	// the group id in case of an activity in group component is the field item_id
	if ( buddypress()->groups->id == $activities_template->activity->component ) {
		$class .= ' rj-' . $activities_template->activity->item_id;
	}	
	return $class;
}
add_filter( 'bp_get_activity_css_class', 'fumow_li_class_group_id', 10, 1 );

You have to create a css class for each group. The example use group ID 13 and 9

li.groups.activity-item.rj-13 {
	background-color: #FFD5F4;
}

li.groups.activity-item.rj-9 {
	background-color: #be4;
}

References:

Activity Loop


bp-activity-templatetags.php

May this help !

Skip to toolbar