Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: How to include a Meta Description and Keywords in bbpress without a plug-in.

@quicoto

Member

Thanks all, got it working with this:

if ( $posts ) {
$out = $posts[0]->post_text;
$out = strip_tags( $out );
$out = str_replace( array( "n", "r" ), ' ', $out );
$out = preg_replace( '|/!]*?[^[*?]|si', '', $out );
$out = substr($out, 0, 200); // only display the first 200 characters of the first post
}

echo "n".'<meta name="description" content="'.$out.'" />';

Skip to toolbar