Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: change CSS according hashtags in activity content


Boone Gorges
Keymaster

@boonebgorges

Cool idea. This can be done using the bp_get_activity_css_class filter hook. For instance,
`
function boone_add_activity_class( $class ) {
global $activities_template;

if ( strpos( $activities_template->activity->content, ‘#red’ ) !== false )
$class .= ‘ red’;

return $class;
}
add_filter( ‘bp_get_activity_css_class’, ‘boone_add_activity_class’ );`

If you add that to your bp-custom.php, it will add the ‘red’ css class to every activity item whose content contains the #red hashtag. You can add more hashtags as needed according to the same pattern.

Then just define your CSS rules, eg
`ul.activity-list .red { background: #f00 }`

Skip to toolbar