<?php
// add a meta description to the head
function daltonsutton_meta_description() {
if (is_home()):
echo '<meta name="description" content="'.get_bloginfo('description').'" />'.PHP_EOL;
endif;
if (is_single() || is_page()):
if ($excerpt = get_the_excerpt()):
echo '<meta name="description" content="' . $excerpt . '" />'.PHP_EOL;
endif;
endif;
}
add_action('wp_head', 'daltonsutton_meta_description');