bbp_get_forum_topics_feed_link

Retrieve the link for the forum feed.

Description

(string) bbp_get_forum_topics_feed_link( (int) $forum_id = 0 ); 

Returns (string)

Parameters (1)

0. $forum_id — Optional. (int)
Forum ID.

Usage

  1. if ( !function_exists( 'bbp_get_forum_topics_feed_link' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/forums/template.php'; 
  3.  
  4. // Optional. Forum ID. 
  5. $forum_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_get_forum_topics_feed_link($forum_id); 
  9.  

Defined (1)

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

/includes/forums/template.php  
  1. function bbp_get_forum_topics_feed_link( $forum_id = 0 ) { 
  2.  
  3. // Validate forum id 
  4. $forum_id = bbp_get_forum_id( $forum_id ); 
  5.  
  6. // Forum is valid 
  7. if ( !empty( $forum_id ) ) { 
  8.  
  9. // Define local variable(s) 
  10. $link = ''; 
  11.  
  12. // Pretty permalinks 
  13. if ( get_option( 'permalink_structure' ) ) { 
  14.  
  15. // Forum link 
  16. $url = trailingslashit( bbp_get_forum_permalink( $forum_id ) ) . 'feed'; 
  17. $url = user_trailingslashit( $url, 'single_feed' ); 
  18.  
  19. // Unpretty permalinks 
  20. } else { 
  21. $url = home_url( add_query_arg( array( 
  22. 'feed' => 'rss2',  
  23. bbp_get_forum_post_type() => get_post_field( 'post_name', $forum_id ) 
  24. ) ) ); 
  25.  
  26. $link = '<a href="' . esc_url( $url ) . '" class="bbp-forum-rss-link topics"><span>' . esc_attr__( 'Topics', bbpress ) . '</span></a>'; 
  27.  
  28. return apply_filters( 'bbp_get_forum_topics_feed_link', $link, $url, $forum_id );