Using the_excerpt for meta description
-
I’m looking to create a default meta description by using the_excerpt. This would be the backup when a meta description wasn’t in place using the AIO SEO plugin.
I’ve read countless articles and tweaked and massaged this but it still won’t work. The version below simply outputs “Array”
<?php if(get_post_meta($post->ID, '_aioseop_description')){ ?> <meta itemprop="description" content="<?php echo get_post_meta($post->ID, '_aioseop_description', $single = true); ?>" /> <?php } else { ?> <meta itemprop="description" content="<?php echo get_post_meta($post->ID, the_excerpt(), $single = true); ?>" /> <?php } ?>
I am a novice that likes to tinker but this has me stumped. I’d appreciate any help in figuring out why the_excerpt isn’t working in this instance and how to fix it.
Thanks in advance.
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Using the_excerpt for meta description’ is closed to new replies.