tyepcho增加自定义字段(最简单的方法)
尝试了很多typecho增加自定义字段的方法,最后在官方文档和搜索引起的帮助下,找到了一个很简单的增加自定义自动的方法,就是在模版目录的functions.php中增加一个方法,代码如下:
function themeFields($layout) {
$keywords = new Typecho_Widget_Helper_Form_Element_Text('keywords', NULL, NULL, _t('关键词'), _t(''));
$description = new Typecho_Widget_Helper_Form_Element_Text('description', NULL, NULL, _t('描述'), _t(''));
$thumb = new Typecho_Widget_Helper_Form_Element_Text('thumb', NULL, NULL, _t('缩略图'), _t(''));
$download = new Typecho_Widget_Helper_Form_Element_Textarea('download', NULL, NULL, _t('下载地址'), _t(''));
$layout->addItem($keywords);
$layout->addItem($description);
$layout->addItem($thumb);
$layout->addItem($download);
echo "<style>.typecho-list-table input[type='text']{width:100%;}.typecho-list-table textarea{width:100%;}</style>";
}
简单吧,你再添加内容看看,是不是出现了你添加的自定义字段,style那个你一看就知道是增加样式的