typecho获取指定页面的相关内容信息

具体看案例把,获取页面缩略名为about的相关内容,标题,链接

<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
<?php while($pages->next()): ?>
<?php if ($pages->slug == 'about'): ?>
<div class="plr10">
      <div class="header">     
        <p class="title"><?php $pages->title(); ?></p>
        <p class="subtitle">ABOUT US</p>
      </div>
      <p class="description"><?php $pages->excerpt(65, '...'); ?> ...</p>
</div>
<a href="<?php $pages->permalink(); ?>" class="more">更多</a> 
<?php endif; ?>
<?php endwhile; ?>
文章由官网发布,如若转载,请注明出处:https://www.veimoz.com/38
1 条评论
2.7k

发表评论

仅有一条评论

  1. tinfeng     Win 10 /    Chrome
    2021-10-25 08:03

    把$pages->slug == 'about'替换成$pages->template=='page-file.php'可指定哪个文件模板

!