farallon/page-categories.php

37 lines
1.3 KiB
PHP
Raw Normal View History

2024-05-17 15:47:27 +08:00
<?php
/**
* 全部分类
*
* @package custom
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('header.php'); ?>
<div class="site--main">
<header class="archive--header">
<h1 class="post--single__title"><?php $this->title() ?></h1>
2024-06-05 15:59:42 +08:00
<h2 class="post--single__subtitle"><?php $this->content(); ?> </h2>
2024-05-17 15:47:27 +08:00
</header>
<section class="category--list">
2024-07-04 20:02:06 +08:00
<?php $this->widget('Widget_Metas_Category_List')->to($categories); ?>
<?php while($categories->next()): ?>
<?php
// 获取分类 ID
$categoryId = $categories->mid;
// 获取主题URL
$themeUrl = $this->options->themeUrl;
// 为每个分类生成图片地址
2024-07-05 09:00:34 +08:00
$categoryImage = $themeUrl . '/dist/img/' . $categoryId . '.jpg';
2024-07-04 20:02:06 +08:00
?>
<div class="category--item">
<img class="category--cover" src="<?php echo $categoryImage; ?>" loading="lazy" alt="<?php $categories->name(); ?>">
<div class="category--content">
<a class="category--card" href="<?php $categories->permalink(); ?>"><?php $categories->name(); ?>
<span>(<?php $categories->count(); ?>)</span></a>
<div class="category--desc"> <?php $categories->description(); ?>
</div>
</div>
</div>
<?php endwhile; ?>
2024-05-18 09:24:49 +08:00
</section>
2024-05-17 15:47:27 +08:00
</div>
<?php $this->need('footer.php'); ?>