up
close

using an older version of IE, huh?

We no longer support older version of Internet Explorer on kohv3. For a better experience try upgrading to a newer version of Internet Explor, Firefox or Chrome.

kohv3 will work in older version but for an enhanced experience, we recommend you upgrade.

close client login

WordPress Hacks: Using Post Excerpts as Meta Descriptions

When you build a static website with a few separate HTML files you find it easy to optimize each page for search engines, load times and meta information. When using a template based application like WordPress, this kind of customization is a bit trickier. But with a few good hacks you’ll be able to easily optimize each page for your needs.

The Problem: WordPress uses the same meta data for each page. The solutions is simple, though:

<?php
//if single post then add excerpt as meta description
if (is_single()) {
?>
<meta name="Description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />
<?php
//if homepage use standard meta description
} else if(is_home() || is_page())  {
?>
<meta name="Description" content="whatever your blog/site is...
read more...