在后台外观-编辑里选择header.php;
找到里面的</head>标签;
在标签上方插入代码:
<?php if(is_single()): ?> <meta name="description" content="<?php echo trim(str_replace('Continue reading →','',strip_tags(get_the_excerpt())));?>"> <?php endif;?>
然后,记得在后台开启摘要功能,每次发博文时记得填写摘要。
这样,以后的每篇博文头部,就都会用摘要做为desrciption显示了。
未经允许不得转载:哈勃私语 » 给wordpress博文的头部header加上描述标签description
本文共268个字 创建时间:2017年9月9日18:56