subscribe

You can update this text in your control panel, under Theme Options. Nam massa. Ut tempor augue non sapien lobortis aliquam. Maecenas.

Just show the excerpt for Meta Description

November 16th, 2009

Here’s a quick script if you want to just display the excerpt for the meta description. I’m using the All In One SEO plugin, which can automatically generate the meta description, but it will use the entire content as opposed to the excerpt. If you’re using a plugin like Smart Youtube this can be a problem. It’s tempting to just add a meta description tag using the_excerpt within the loop on a single page, but that wouldn’t validate, so add this to your header instead. Enjoy!
<?php if (is_single()):while(have_posts()):the_post();
echo ‘<meta name=”description” content=”‘;
$out_excerpt = str_replace(array(”\r\n”, “\r”, “\n”), “”, get_the_excerpt());
echo apply_filters(’the_excerpt_rss’, $out_excerpt);
echo ‘” />’;
endwhile;
endif;
?>

Thanks to Michele for the snippet

Tags: , , ,

3 Responses to Just show the excerpt for Meta Description

  1. Elena says:

    ……

    Бизнесмен из Вас отличный…

  2. Frankie says:

    Привет!! carlos@onlylcd.ru” rel=”nofollow”>……

    С уважением,…

  3. TIM says:

    Pillspot.org. Canadian Health&Care.Special Internet Prices(up to 40% off average US price).No prescription online pharmacy.PillSpot.org. Vitamins@buy.online” rel=”nofollow”>.…

    Categories: Eye Care.Mental Health/Epilepsy.Vitamins/Herbal Supplements.Antidiabetic.Antidepressants.General Health.Stop SmokingCholesterol.Womens Health.Anti-allergic/Asthma.Mens Health.Stomach.Pain Relief.Anxiety/Sleep Aid.Skin Care.Antiviral.We…

Leave a Reply

Name and Email Address are required fields. Your email will not be published or shared with third parties.

Spam protection by WP Captcha-Free