With the help of the answer given at Place category_description in the meta description (wordpress) I think I’ve got this almost figured out, but it just doesn’t seem to be working – when I view the page source for any page, the meta description is empty:
<meta name="description" content="" />
Here’s what I’ve got:
In functions.php
<?php
if( is_single() || is_page() ) $description = get_the_excerpt();
elseif( is_category() ) $description = category_description();
else $description = "Free French lessons and language tools from Laura K. Lawless, including verb conjugations and bilingual articles to help you improve your reading and listening comprehension.";
$description = substr($description,0,500);
?>
In header
<meta name="description" content="<?= $description ?>" />
Any ideas? TIA!
Try this function, it will return something in most cases.