bb_get_tag_link

The BuddyPress bb get tag link function.

Description

bb_get_tag_link( (int) $tag_id = 0, (int) $page = 1, $context = ); 

Parameters (3)

0. $tag_id — Optional. (int)
The tag id.
1. $page — Optional. (int) => 1
The page.
2. $context
The context.

Usage

  1. if ( !function_exists( 'bb_get_tag_link' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-template.php'; 
  3.  
  4. // The tag id. 
  5. $tag_id = -1; 
  6.  
  7. // The page. 
  8. $page = 1; 
  9.  
  10. // The context. 
  11. $context = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bb_get_tag_link($tag_id, $page, $context); 
  15.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-template.php  
  1. function bb_get_tag_link( $tag_id = 0, $page = 1, $context = BB_URI_CONTEXT_A_HREF
  2. global $tag; 
  3.  
  4. if ( $tag_id ) { 
  5. if ( is_object( $tag_id ) ) { 
  6. $_tag = $tag_id; 
  7. } else { 
  8. $_tag = bb_get_tag( $tag_id ); 
  9. } else { 
  10. $_tag =& $tag; 
  11.  
  12. if ( !is_object( $_tag ) ) { 
  13. return ''; 
  14.  
  15. if ( !$context || !is_integer( $context ) ) { 
  16. $context = BB_URI_CONTEXT_A_HREF
  17.  
  18. if ( bb_get_option( 'mod_rewrite' ) ) { 
  19. $page = (1 < $page) ? '/page/' . $page : ''; 
  20. $r = bb_get_uri( 'tags/' . $_tag->tag . $page, null, $context ); 
  21. } else { 
  22. $query = array( 
  23. 'tag' => $_tag->tag,  
  24. 'page' => ( 1 < $page ) ? $page : false 
  25. ); 
  26. $r = bb_get_uri( 'tags.php', $query, $context ); 
  27.  
  28. return apply_filters( 'bb_get_tag_link', $r, $_tag->tag, $page, $context );