最近发现网站主题的TAG页面标题,只有一个TAG名词和网站名称,不利于搜索引擎排名匹配,因此计划修改下,因是使用的Wordpress主题,所以就咨询了下主题技术,得出以下的修改方法。
词方法仅限于“主题盒子-hot主题”修改。其他的模板主题请勿按照此方法操作。本人也是记录下,方便后面的修改。
第一、打开文件:/wp-content/themes/wpzt-hot/inc/framework/config/taxonomy.php 参考下截图:
第二、在:“taxonomy.php”文件的代码最后面,添加如下代码:
$prefix_tag=CS_TAXONOMY_TAG;
CSF::createTaxonomyOptions($prefix_tag, array(
'id' => 'tag_options',
'taxonomy' => 'post_tag', // category, post_tag or your custom taxonomy name
'data_type' => 'serialize',
));
CSF::createSection($prefix_tag,array(
'title'=>'标签SEO设置',
'fields'=>array(
array(
'id' => 'seo_custom_title',
'type' => 'text',
'title' => 'SEO自定义标题',
'after' => '<div class="cs-text-muted">留空则调用默认全局SEO设置</div>'
),
array(
'id' => 'seo_custom_keywords',
'type' => 'text',
'title' => 'SEO自定义关键词',
'after' => '<div class="cs-text-muted">留空则调用默认全局SEO设置</div>'
),
array(
'id' => 'seo_custom_desc',
'type' => 'textarea',
'title' => 'SEO自定义描述',
'after' => '<div class="cs-text-muted">留空则调用默认全局SEO设置</div>'
),
)
));
第三、打开:/wp-content/themes/wpzt-hot/vendor/wpzt/Home.php 修改:“Home.php”文件,
在大概377行。添加如下代码:
$title['title'].='_帝国模板_帝国CMS模板_帝国网站模板';
至此,完成!