Forums
-
- Forum
- Posts
-
- Installation
- 28,380
- Troubleshooting
- 62,264
- Themes
- 10,391
- Plugins
- 15,313
- Requests & Feedback
- 14,918
- 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.'" />';