bbp_get_topic_freshness_link

Returns link to the most recent activity inside a topic, complete with link attributes and content.

Description

(string) bbp_get_topic_freshness_link( (int) $topic_id = 0 ); 

Returns (string)

Topic freshness link

Parameters (1)

0. $topic_id — Optional. (int)
Topic id

Usage

  1. if ( !function_exists( 'bbp_get_topic_freshness_link' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/topics/template.php'; 
  3.  
  4. // Optional. Topic id 
  5. $topic_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_get_topic_freshness_link($topic_id); 
  9.  

Defined (1)

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

/includes/topics/template.php  
  1. function bbp_get_topic_freshness_link( $topic_id = 0 ) { 
  2. $topic_id = bbp_get_topic_id( $topic_id ); 
  3. $link_url = bbp_get_topic_last_reply_url( $topic_id ); 
  4. $title = bbp_get_topic_last_reply_title( $topic_id ); 
  5. $time_since = bbp_get_topic_last_active_time( $topic_id ); 
  6.  
  7. if ( !empty( $time_since ) ) 
  8. $anchor = '<a href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $time_since ) . '</a>'; 
  9. else 
  10. $anchor = __( 'No Replies', bbpress ); 
  11.  
  12. return apply_filters( 'bbp_get_topic_freshness_link', $anchor, $topic_id, $time_since, $link_url, $title );