当我在博主上时,这对我来说更容易,我想在没有插件的情况下自动将帖子标题转换为元关键字。
例如帖子标题:这是我的标题帖子标签: 我的标题, 我的标题
关键字结果:"这是我的标题,我的标题,我的标题"
任何帮助将不胜感激,我不是编码员
是的,您可以通过在标头模板中设置代码来执行此操作,如下所示,
<?php
if (have_posts()) : the_post();
$custom_fields = get_post_custom();
$custom_meta_description = $custom_fields['meta-description'];
$custom_meta_keywords = $custom_fields['meta-keywords'];
if ( !empty($custom_meta_description[0]) )
{
echo "<meta http-equiv='description' content='" . $custom_meta_description[0] . "' />\r
";
}
if ( !empty($custom_meta_keywords[0]) )
{
echo "<meta http-equiv='keywords' content='" . $custom_meta_keywords[0] . "' />\r
";
}
rewind_posts();
endif;
?>
后
<title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title>