wordpress添加关键字

2023-10-18 09:33:11 浏览数 (1)

wordpress自动添加标签为关键字;

代码语言:javascript复制
<?php
//判断是否为首页
if ( is_home ())
{
$description = "jcomey一个文艺青年的个人博客";
$keywords = "文艺青年,前端教程,技术宅,新文化苦旅";
//判断是否为文章页
}
else if ( is_single ())
{
if ( $post->post_excerpt)
{
$description = $post->post_excerpt;

} else {
$description = mb_strimwidth(strip_tags(apply_filters('the_content',$post->post_content)
),0,220);

}
$keywords = "";
$tags = wp_get_post_tags($post->ID);
foreach ($tags as $tag ) {
$keywords = $keywords.$tag->name.","; }

} else if ( is_category()) {
$description = category_description();

}
?>

0 人点赞