bbp_is_topic_sticky

Is the topic a sticky or super sticky?.

Description

bbp_is_topic_sticky( (int) $topic_id = 0, (bool) $check_super = true ); 

Parameters (2)

0. $topic_id — Optional. (int)
Topic id
1. $check_super — Optional. (bool) => true
If set to true and if the topic is not a normal sticky, it is checked if it is a super sticky or not. Defaults to true.

Usage

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

Defined (1)

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

/includes/topics/template.php  
  1. function bbp_is_topic_sticky( $topic_id = 0, $check_super = true ) { 
  2. $topic_id = bbp_get_topic_id( $topic_id ); 
  3. $forum_id = bbp_get_topic_forum_id( $topic_id ); 
  4. $stickies = bbp_get_stickies( $forum_id ); 
  5.  
  6. if ( in_array( $topic_id, $stickies ) || ( !empty( $check_super ) && bbp_is_topic_super_sticky( $topic_id ) ) ) 
  7. return true; 
  8.  
  9. return false;