bb_show_topic_context
The BuddyPress bb show topic context function.
Description
Parameters (2)
- 0. $term
- The term.
- 1. $text
- The text.
Usage
if ( !function_exists( 'bb_show_topic_context' ) ) { require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-formatting.php'; } // The term. $term = null; // The text. $text = null; // NOTICE! Understand what this does before running. $result = bb_show_topic_context($term, $text);
Defined (1)
The function is defined in the following location(s).
- /bp-forums/bbpress/bb-includes/functions.bb-formatting.php
- function bb_show_topic_context( $term, $text ) {
- $text = strip_tags( $text );
- $term = preg_quote( $term );
- $text = preg_replace( "|.*?(.{0, 80})$term(.{0, 80}).*|is", "$1<strong>$term</strong>$2", $text, 1 );
- $text = substr( $text, 0, 210 );
- return $text;
- }