bp_get_activity_css_class

Return the current activity item's CSS class.

Description

(string) bp_get_activity_css_class(); 

Returns (string)

The activity item's CSS class.


Usage

  1. if ( !function_exists( 'bp_get_activity_css_class' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_get_activity_css_class(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-activity/bp-activity-template.php  
  1. function bp_get_activity_css_class() { 
  2. global $activities_template; 
  3.  
  4. /** 
  5. * Filters the available mini activity actions available as CSS classes. 
  6. * @since 1.2.0 
  7. * @param array $value Array of classes used to determine classes applied to HTML element. 
  8. */ 
  9. $mini_activity_actions = apply_filters( 'bp_activity_mini_activity_types', array( 
  10. 'friendship_accepted',  
  11. 'friendship_created',  
  12. 'new_blog',  
  13. 'joined_group',  
  14. 'created_group',  
  15. 'new_member' 
  16. ) ); 
  17.  
  18. $class = ' activity-item'; 
  19.  
  20. if ( in_array( $activities_template->activity->type, (array) $mini_activity_actions ) || empty( $activities_template->activity->content ) ) { 
  21. $class .= ' mini'; 
  22.  
  23. $class .= ' has-comments'; 
  24.  
  25. /** 
  26. * Filters the determined classes to add to the HTML element. 
  27. * @since 1.0.0 
  28. * @param string $value Classes to be added to the HTML element. 
  29. */ 
  30. return apply_filters( 'bp_get_activity_css_class', $activities_template->activity->component . ' ' . $activities_template->activity->type . $class );