Typecho后台设置统计代码
AI摘要:本文介绍如何在Typecho博客系统中添加统计代码。需在主题的functions.php中添加表单元素代码,创建后台统计代码输入框,然后在footer.php中插入调用代码,使统计代码生效。
以默认主题为例,在functions.php
中找到themeConfig
函数,在里面插入以下代码:
$analytics = new Typecho_Widget_Helper_Form_Element_Textarea('analytics', NULL, NULL, _t('统计代码'), _t('在这里添加统计代码'));
$form->addInput($analytics);
然后在footer.php
中,插入
<?php $this->options->analytics(); ?>