Using this code
<?php
$post = $wp_query->post;
$descrip = strip_tags($post->post_content);
$descrip_more = '';
if (strlen($descrip) > 155) {
$descrip = substr($descrip,0,155);
$descrip_more = ' ...';
}
$descrip = str_replace('"', '', $descrip);
$descrip = str_replace("'", '', $descrip);
$descripwords = preg_split('/[\n\r\t ]+/', $descrip, -1, PREG_SPLIT_NO_EMPTY);
array_pop($descripwords);
$descrip = implode(' ', $descripwords) . $descrip_more; $descrip = strip_shortcodes($descrip );
echo '<meta name="description" content="'.$descrip.'">'; ?>
Which outputs something like this in my header:
<meta name="description" content=" Everything year life dont know why but ...">
I was wondering if I could add something to the code that would add the single post title before the "Everything year life dont know why but ..." part, at the beginning of the content, so it looks like
Maybe out it like this?
<meta name="description" content=" Uverworld - nano second (<-- the post title) Everything year life dont know why but ...">
in other words
<meta name="description" content=" Uverworld - nano second Everything year life dont know why but ...">
--
The above code also leaves a lot of spaces before the content and shows up like Is there a way to get rid of that as well?