Typecho神奇的is语法

in Typecho with 0 commentand 2519 read

typecho可以使用is语法判断很多东西,比如

$this->is('index');
$this->is('archive');
$this->is('single');
$this->is('page');
$this->is('post');
$this->is('category');
$this->is('tag');

甚至是

$this->is('category', 'default');
$this->is('page', 'start');
$this->is('post', 1);

需要注意的是,后面的参数是分类、页面的缩略名,写法如

<?php if ($this->is('post')) : ?>
// 这里就是内容了
<?php endif; ?>
评论