Wordpress
Dynamic Meta Description and Keywords howto diye bir yazıya rasladım header.php eklenecek kodları verilmiş yanlız ingilizce olduğu için tam anlamadım ingilizce bilen arkadaşlar buraya yazabilirler mi acaba
This is a quick guide to add dynamic meta description and keyword to each different url of our Wordpress blog, very useful to SEO users.
Open your header.php file from your theme directory and put this code into:
Meta Content Description
Alıntı
<meta name="description" content="
<?php if (have_posts() && is_single() OR is_page()):while(have_posts()):the_post();
$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", get_the_excerpt());
echo apply_filters('the_excerpt_rss', $out_excerpt);
endwhile;
elseif(is_category() OR is_tag()):
if(is_category()):
echo "Posts related to Category:
".ucfirst(single_cat_title("", FALSE));
elseif(is_tag()):
echo "Posts related to Tag:
".ucfirst(single_tag_title("", FALSE));
endif;
else: ?>
ADD HERE YOUR DEFAULT DESCRIPTION
<?php endif; ?>" />
Meta Content Keywords
Alıntı
<meta name="keywords" content="
<?php
$tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
$xt = 1;
foreach ($tags as $tag) {
if ($xt <= 20) {
echo $tag->name.", ";
}
$xt++;
}
?>ADD, HERE, YOUR, STATIC, KEYWORDS" />