Forums
-
- Forum
- Posts
-
- Installation
- 28,369
- Troubleshooting
- 62,138
- Themes
- 10,387
- Plugins
- 15,305
- Requests & Feedback
- 14,888
- Showcase
- 3,252
-
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