Forums
-
- Forum
- Posts
-
- Installation
- 27,623
- Troubleshooting
- 60,561
- Themes
- 10,191
- Plugins
- 14,975
- Requests & Feedback
- 14,607
- Showcase
- 3,238
-
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.'" />';
See also: WordPress.org • bbPress.org • BuddyPress.org • Matt • Blog RSS