Typecho 自定义字段指南
🕙2023-06-03
添加自定义字段
ex:添加字段名为status
,字段值为off
判断自定义字段
<?php if($this->fields->status == "off"){ echo 'this is off';} ?>
判断自定义字段是否存在
if(isset($this->fields->fieldName)){
echo '字段存在,值为:'.$this->fields->fieldName;
}else{
echo '字段不存在';
}
文章自动加入自定义字段
在functions.php中
function themeFields($layout) {
$title = new Typecho_Widget_Helper_Form_Element_Text('title', NULL, NULL, _t('文章title标题'), _t('SEO
$layout->addItem($title);
}