1 Star 0 Fork 0

gpress / wp-astra

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
category.html 3.97 KB
一键复制 编辑 原始数据 按行查看 历史
springrain 提交于 2024-04-23 09:00 . 修改sql语句
<!-- 查询 content 列表 -->
{{ $contentSQL :="* FROM content WHERE status=1 and categoryID=? order by sortNo desc" }}
{{ $categorySQL := "* FROM category WHERE id=? and status<2 order by sortNo desc"}}
{{ if eq .userType 1}}
{{ $contentSQL ="* FROM content WHERE categoryID=? order by sortNo desc" }}
{{ $categorySQL = "* FROM category WHERE id=? order by sortNo desc"}}
{{end}}
{{ $selectList := selectList "content" .q .pageNo 12 $contentSQL .UrlPathParam }}
{{ $nav := selectOne "category" $categorySQL .UrlPathParam }}
{{ $site:=site }}
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<title>{{ $nav.Name }}</title>
<meta name="description" content="{{ $nav.Description }}" />
<meta name="keyword" content="{{ $nav.Keyword }}" />
{{template "bodystart.html" }}
<section class="ast-archive-description">
<h1 class="page-title ast-archive-title">{{$nav.Name}}</h1>
</section>
<main id="main" class="site-main">
<div class="ast-row">
{{ range $k,$v := $selectList.Data }}
<article id="{{$v.Id}}" class="{{$v.Id}} post type-post status-publish format-standard hentry category-uncategorized ast-grid-common-col ast-full-width ast-article-post remove-featured-img-padding" itemtype="https://schema.org/CreativeWork" itemscope="itemscope">
<div class="ast-post-format- ast-no-thumb blog-layout-4 ast-article-inner">
<div class="post-content ast-grid-common-col">
<div class="ast-blog-featured-section post-thumb ast-blog-single-element"></div>
<span class="ast-blog-single-element ast-taxonomy-container cat-links default">
<a href="{{basePath}}category/{{.CategoryID}}" rel="category tag">{{ $v.CategoryName }}</a></span>
<h2 class="entry-title ast-blog-single-element" itemprop="headline">
<a href="{{basePath}}post/{{$v.Id}}" rel="bookmark">{{$v.Title}}</a>
</h2>
<header class="entry-header ast-blog-single-element ast-blog-meta-container">
<div class="entry-meta">
<span class="posted-by vcard author" itemtype="https://schema.org/Person" itemscope="itemscope" itemprop="author">
<span class="author-name" itemprop="name">{{$v.Author}} </span>
</span>
/ <span class="posted-on"><span class="published" itemprop="datePublished"> {{ slice $v.UpdateTime 0 10 }}
</span></span></div>
</header><!-- .entry-header -->
<div class="ast-excerpt-container ast-blog-single-element">
{{ .Summary }}
</div>
<div class="entry-content clear" itemprop="text">
</div><!-- .entry-content .clear -->
</div><!-- .post-content -->
</div> <!-- .blog-layout-4 -->
</article><!-- #post-## -->
{{end}}
</div>
</main><!-- #main -->
{{if gt $selectList.Page.PageCount 1}}
<div class='ast-pagination'>
<nav class="navigation pagination" role="navigation" aria-label="Post pagination">
<span class="screen-reader-text">Post pagination</span>
<div class="nav-links">
{{$currPageNo := $selectList.Page.PageNo}}
{{if lt $currPageNo 1}}
{{$currPageNo = 1}}
{{end}}
{{if gt $currPageNo $selectList.Page.PageCount }}
{{$currPageNo = $selectList.Page.PageCount}}
{{end}}
{{if gt $currPageNo 1}}
<a class="prev page-numbers" href="{{basePath}}category/{{.UrlPathParam}}/page/{{ addInt $currPageNo -1 }}">
<span class="ast-left-arrow">&larr;</span> 上一页
</a>
{{end}}
{{ range $index, $value := (seq 1 $selectList.Page.PageCount) }}
{{ if eq $currPageNo $value }}
<span aria-current="page" class="page-numbers current">{{$value}}</span>
{{else}}
<a class="page-numbers" href="{{basePath}}category/{{$.UrlPathParam}}/page/{{$value}}">{{$value}}</a>
{{end}}
{{ end }}
{{if lt $currPageNo $selectList.Page.PageCount}}
<a class="next page-numbers" href="{{basePath}}category/{{$.UrlPathParam}}/page/{{ addInt $currPageNo 1 }}">下一页
<span class="ast-right-arrow">&rarr;</span>
</a>
{{end}}
</div>
</nav>
</div>
{{end}}
{{template "bodyend.html" }}
1
https://gitee.com/gpress/wp-astra.git
git@gitee.com:gpress/wp-astra.git
gpress
wp-astra
wp-astra
master

搜索帮助