开发者

wordpress plug-in or anything that will allow us to edit the meta tags for each individual post?

I researched at google but couldnot find anything开发者_如何学编程.

Is there a plug-in or anything that will allow us to edit the meta tags for each individual post?

Appreciate helps! thanks.


You can also work with the meta description field in pages, single posts and post categories without a plugin by using a custom field called "description" and the built in category descriptions:

<meta name="description" content="<?php if (is_page()) { echo get_post_meta($post->ID, 'description', true);

} elseif (is_category()) { echo trim(strip_tags(category_description()));

} elseif (is_single()) { echo $title = get_the_title();

} else { echo bloginfo('description'); } ?>" />

Adapted from Stupid WordPress Tricks • Perishable Press


I suppose there are ; for instance, if you search for "meta tags" in wordpress' plugin lists, you'll get a few answers.


One of those answers is All in One SEO Pack -- which has good ratings, seems to work with recent versions of Wordpress, and has been recently updated.

Amongst the features, you'll see (quoting) :

  • Generates META tags automatically
  • You can override any title and set any META description and any META keywords you want.


Personally I use the excerpt field as the meta description if the page is a single post & the excerpt contains some text. Code for header.php:

<?php
if (is_single() && $post->post_excerpt != “”) {
$post = $wp_query->post;
$descrip = strip_tags($post->post_excerpt);
echo ‘<meta name=”description” content=”‘.$descrip.’”>’;
}
?>

I detailed the technique in this blog post.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜