typecho主题常用化码

typecho主题常用化码

小唐
2023-05-13 / 0 评论 / 130 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2023年05月13日,已超过349天没有更新,若内容或图片失效,请留言反馈。

修改 Typecho 主题时,需要判断当前用户角色,对于管理员角色,显示内容,可使用如下:

    <?php $currGroup = get_object_vars($this->user) ['row']['group'];if ($currGroup == "administrator"): ?> 
    若为管理员,显示此区域内容 
    <?php else: ?>//else可去 
    非管理员,显示此区域内容 
    <?php endif;?>

登陆

    <?php $this->options->adminUrl('login.php'); ?>

注册

    <?php $this->options->adminUrl('register.php'); ?>

站点名称

    <?php $this->options->title(); ?>

域名地址

    <?php $this->options->siteUrl(); ?>

后台地址

    <?php $this->options->adminUrl(); ?>

完整路径地址:文章

    <?php $this->archiveTitle(' &raquo; ', '', ' - '); ?&gt;&lt;?php $this->options->title(); ?>

网站说明

    <?php $this->options->description(); ?>

模板地址

    <?php $this->options->themeUrl(); ?>

作者名字

    <?php $this->author(); ?>

当前登陆名

    <?php $this->user->screenName(); ?>

退出链接

    <a href="<?php $this->options->logoutUrl(); ?>" ><?php _e('退出');?></a>

作者头像

    <?php $this->author->gravatar('200') ?>

该作者全部文章链接

    <?php $this->author->permalink(); ?>

该文章作者个人主页链接

    <?php $this->author->url(); ?>

该文章作者邮箱

    <?php $this->author->mail(); ?>

引用模板php文件

    <?php $this->need('*.php'); ?>

评论

    <?php $this->options->commentsFeedUrl(); ?>

头部HEAD常用

<?php $this->keywords('_'); ?>//关键词
<?php $this->options->title(); ?>//站点名称
<?php $this->options->description(); ?>//站点描述
<?php $this->archiveTitle(); ?>//标题
<?php $this->options->themeUrl('ie.css'); ?>//模板路径
<?php $this->options->siteUrl(); ?>//主页网址
<?php $this->options->feedUrl(); ?>
<?php $this->options->commentsFeedUrl(); ?>
<?php $this->pageNav(); ?>//分页
<?php $this->options->generator(); ?>//版本号

文章页面常用

<?php $this->title(); ?>//标题
<?php $this->category(','); ?>//分类
<?php $this->tags(', ', true, ''); ?>//标签
<?php $this->date('F jS, Y') ?>//时间
<?php $this->content(); ?>//内容
<?php $this->thePrev('&laquo; %s', ''); ?>//上一篇
<?php $this->theNext('%s &raquo;', ''); ?>//下一篇

常用调用作者信息

<?php $this->author() ?>  //作者名称
<?php $this->author->permalink(); ?>  //作者文章列表连接
<?php $this->author->url(); ?>
<?php $this->author('url'); ?>  //作者主页
<?php $this->author->mail(); ?>
<?php $this->author('mail'); ?>  //作者邮箱
<?php $this->author->gravatar(); ?>  //作者头像

评论都信息

<?php $comments->author(); ?>  //带连接的作者名
<?php $comments->author('', false); ?>  //不带连接的作者名
0

评论

博主关闭了所有页面的评论,留言评论可通过微信关注公众号:得水小筑