Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: change styling if freshness less than 24 hours

@robin-w

Moderator

try this

add_filter ('bbp_get_forum_freshness_link' , 'rew_check_freshness', 10 , 6 ) ;

function rew_check_freshness ($anchor, $forum_id, $time_since, $link_url, $title, $active_id) {
	$last_active = get_post_meta( $forum_id, '_bbp_last_active_time', true );
	$diff = strtotime('now') - strtotime($last_active) ;
	if ($diff<86400) {
	$anchor = '<span class="fresh">'.$anchor.'</span>' ;
	}
return $anchor ;	
}

This adds an extra span class called ‘fresh’ if the last active is less than 24 hours.

you can then style this in css eg

.fresh {
background-color : green ;
}
Skip to toolbar