bp_activity_newest_class

Add a just-posted classes to the most recent activity item.

Description

(string) bp_activity_newest_class( (string) $classes = '' ); 

We use these classes to avoid pagination issues when items are loaded dynamically into the activity stream.

Returns (string)

$classes

Parameters (1)

0. $classes — Optional. (string) => ''
Array of classes for most recent activity item.

Usage

  1. if ( !function_exists( 'bp_activity_newest_class' ) ) { 
  2. require_once '/bp-activity/bp-activity-filters.php'; 
  3.  
  4. // Array of classes for most recent activity item. 
  5. $classes = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_activity_newest_class($classes); 
  9.  

Defined (1)

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

/bp-activity/bp-activity-filters.php  
  1. function bp_activity_newest_class( $classes = '' ) { 
  2. $bp = buddypress(); 
  3.  
  4. if ( ! empty( $bp->activity->last_recorded ) && $bp->activity->last_recorded == bp_get_activity_date_recorded() ) { 
  5. $classes .= ' new-update'; 
  6.  
  7. $classes .= ' just-posted'; 
  8. return $classes;