ripro如何禁止‘分类名称’自动加入‘关键词’
教程开始:
找到文件/wp-content/themes/ripro/inc/theme-functions.php
搜索 $keywords = \’\’;
大概在415行~434行,这是原来未修改的代码。
$keywords = \'\';
if (is_singular()) {
if (get_the_tags($post->ID)) {
foreach (get_the_tags($post->ID) as $tag) {
$keywords .= $tag->name . \',\';
}
}
foreach (get_the_category($post->ID) as $category) {
$keywords .= $category->cat_name . \', \';
}
if (get_post_meta($post->ID, \'post_keywords_s\', true)) {
$the = trim(get_post_meta($post->ID, \'keywords\', true));
if ($the) {
$keywords = $the;
}
} else {
$keywords = substr_replace($keywords, \'\', -2);
}
将以下代码替换上面的即可
$keywords = \'\';
if (is_singular()) {
if (get_the_tags($post->ID)) {
foreach (get_the_tags($post->ID) as $tag) {
$keywords .= $tag->name . \',\';
}
}
if (get_post_meta($post->ID, \'post_keywords_s\', true)) {
$the = trim(get_post_meta($post->ID, \'keywords\', true));
if ($the) {
$keywords = $the;
}
} else {
$keywords = substr_replace($keywords, \'\', -1);
}
搞垫收工!!!