Using the_excerpt as meta
-
Hello,
I am trying to use my post excerpt as og:description meta data. I am using some code I found with a minor modification. The problem I am having is that post_excerpt seems to return nothing.
Any help would be appreciated.
<?php function og_meta_desc() { global $post; $meta = strip_tags($post->post_excerpt); $meta = str_replace(array("\n", "\r", "\t"), ' ', $meta); $meta = substr($meta, 0, 200); if ( $meta != '' ) { echo "<meta property=\"og:description\" content=\"$meta\" />"; } else { echo "<meta property=\"og:description\" content=\"WTF\" />"; } } og_meta_desc(); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Using the_excerpt as meta’ is closed to new replies.