/** * Little Green Man functions and definitions * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package WordPress * @subpackage LGM * @since Little Green Man 1.1 */ /** * Create Meta Description - code from Greta Themes https://gretathemes.com/seo-add-meta-tags-without-plugins */ function gretathemes_meta_description() { global $post; if ( is_singular() ) { $des_post = strip_tags( $post->post_content ); $des_post = strip_shortcodes( $post->post_content ); $des_post = str_replace( array("\n", "\r", "\t"), ' ', $des_post ); $des_post = mb_substr( $des_post, 0, 300, 'utf8' ); echo '' . "\n"; } if ( is_home() ) { echo '' . "\n"; } if ( is_category() ) { $des_cat = strip_tags(category_description()); echo '' . "\n"; } } add_action( 'wp_head', 'gretathemes_meta_description'); function gretathemes_meta_tags() { echo ''; } add_action('wp_head', 'gretathemes_meta_tags');