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

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

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

发表评论

仅有一条评论

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

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

!