Skip to content

Instantly share code, notes, and snippets.

@zaerl
Created October 13, 2012 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaerl/3884515 to your computer and use it in GitHub Desktop.
Save zaerl/3884515 to your computer and use it in GitHub Desktop.
bbPress 1,000 count bug
// add_filter( 'bbp_get_topic_reply_count', 'bbp_number_format', 10 );
add_filter( 'bbp_topic_reply_count', 'bbp_number_format', 10 );
/**
* Output total reply count of a topic
*
* @since bbPress (r2485)
*
* @param int $topic_id Optional. Topic id
* @uses bbp_get_topic_reply_count() To get the topic reply count
*/
function bbp_topic_reply_count( $topic_id = 0 ) {
$replies = bbp_get_topic_reply_count( $topic_id );
return apply_filters( 'bbp_topic_reply_count', (int) $replies, $topic_id );
}
/**
* Return total reply count of a topic
*
* @since bbPress (r2485)
*
* @param int $topic_id Optional. Topic id
* @uses bbp_get_topic_id() To get the topic id
* @uses get_post_meta() To get the topic reply count meta
* @uses apply_filters() Calls 'bbp_get_topic_reply_count' with the
* reply count and topic id
* @return int Reply count
*/
function bbp_get_topic_reply_count( $topic_id = 0 ) {
$topic_id = bbp_get_topic_id( $topic_id );
$replies = get_post_meta( $topic_id, '_bbp_reply_count', true );
return apply_filters( 'bbp_get_topic_reply_count', (int) $replies, $topic_id );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment