Skip to content

Commit 2e460f5

Browse files
committed
v1.0.0
1 parent 8a54d8a commit 2e460f5

File tree

5 files changed

+94
-87
lines changed

5 files changed

+94
-87
lines changed

README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Text Only
22

3-
主题介绍: Text Only 是一款 Typecho & WordPress 纯文本极简主题,黑白配色,对程序极简优化,主题无 JS 和图片文件载入。主题支持自定义背景、自定义菜单,保留搜索及评论功能;内置文章归档和搜索模板;已作中文字体优化,内置3种字体方案可选。
3+
主题介绍: Text Only 是一款 Typecho & WordPress 纯文本极简主题,黑白配色,对程序极简优化,主题无 JS 和图片文件载入。主题支持自定义背景、自定义菜单,保留搜索及评论功能;内置文章归档和搜索模板;已作中文字体优化,内置3种字体方案可选。力求极简,对程序自带功能进行禁用,若对使用有影响,按需删除即可。
44

55
关键词: 极简,博客,纯文本,单栏,自适应,免费
66

7-
主题发布页: https://yayu.net/projects/typecho-textonly
7+
主题发布页: https://yayu.net/projects/wordpress-textonly
88

99
作者: Jeff Chen
1010

1111
作者网站: https://yayu.net/
1212

13-
最新版本: 1.0.2
13+
最新版本: 1.0.0
1414

1515
授权方式: CC BY-NC-SA 4.0 DEED
1616

@@ -20,7 +20,7 @@
2020
## 使用方法
2121

2222
1. 上传并激活主题,开箱即用。
23-
2. 主题已内置3种字体方案,分别为雅黑、仿宋和宋体。如需要调整字体,在“外观”》“主题文件编辑器”中选择编辑 style.css 样式文件,根据提示对第19行进行修改
23+
2. 主题已内置3种字体方案,分别为雅黑、仿宋和宋体。如需要调整字体,在“外观”》“主题文件编辑器”中选择编辑 style.css 样式文件,根据提示对第31行进行修改
2424

2525

2626
## 页面模板/所有文章
@@ -33,12 +33,10 @@
3333
“搜索模板”中包含搜索框及结果列表。
3434

3535

36+
## 常见问题
3637

37-
## 迭代日志
38+
__主题禁用功能和插件冲突怎么办?__
3839

39-
### Version 1.0.2 (2024-07-21)
40-
- 搜索搜索结果文章链接
41-
- 部分代码小调整
40+
使用代码编辑器打开主题内 functions.php,删除冲突部分的代码,上传文件替换即可。
4241

43-
### Version 1.0.0 (2024-07-08)
44-
- 始发
42+
有问题可随时在作者网站留言交流。

header.php

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
1-
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
2-
<!DOCTYPE HTML>
3-
<html>
1+
<!DOCTYPE html>
2+
<html <?php language_attributes(); ?>>
43
<head>
5-
<meta charset="<?php $this->options->charset(); ?>">
4+
<meta charset="<?php bloginfo( 'charset' ); ?>">
65
<meta name="viewport" content="width=device-width, initial-scale=1">
7-
<title><?php $this->archiveTitle(['category' => _t('%s'),'search' => _t('搜索结果:%s'),'tag' => _t('标签:%s'),'author' => _t('作者:%s')], '', ' - '); ?><?php $this->options->title(); ?></title>
8-
<?php $this->header(); ?>
9-
<link rel="stylesheet" href="<?php $this->options->themeUrl('style.css'); ?>">
6+
<link rel="profile" href="https://gmpg.org/xfn/11">
7+
<?php wp_head(); ?>
108
</head>
11-
<body>
9+
<body <?php body_class(); ?>>
1210
<header>
13-
<div class="heading"><h1 class="title"><a href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title() ?></a></h1>
14-
<div class="intro"><?php $this->options->description() ?></div></div>
11+
<div class="heading"><h1 class="title"><a href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a></h1>
12+
<div class="intro"><?php bloginfo( 'description' ); ?></div></div>
1513
<nav>
16-
<a<?php if ($this->is('index')): ?> class="current"<?php endif; ?> href="<?php $this->options->siteUrl(); ?>"><?php _e('首页'); ?></a>
17-
<?php $this->widget('Widget_Metas_Category_List')->to($category); ?>
18-
<?php while($category->next()): ?>
19-
<a<?php if($this->is('category', $category->slug)): ?> class="current"<?php endif; ?> href="<?php $category->permalink(); ?>" title="<?php $category->name(); ?>"><?php $category->name(); ?></a>
20-
<?php endwhile; ?>
21-
<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
22-
<?php while ($pages->next()): ?>
23-
<a<?php if ($this->is('page', $pages->slug)): ?> class="current"<?php endif; ?> href="<?php $pages->permalink(); ?>" title="<?php $pages->title(); ?>"><?php $pages->title(); ?></a>
24-
<?php endwhile; ?>
14+
<?php if ( has_nav_menu( 'primary-menu' ) ) :
15+
$menuParameters = array('container' => false,'echo' => false,'menu_class' => 'menu','items_wrap' => '%3$s','depth' => 0,);
16+
echo strip_tags(wp_nav_menu( $menuParameters ), '<a>' );
17+
endif;?>
2518
</nav>
2619
</header>
2720
<main>

index.php

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
1-
<?php
2-
/**
3-
* Text Only 为纯文本极简主题,黑白配色,对程序极简优化,主题无 JS 和图片文件载入。主题支持自定义背景、自定义菜单,保留搜索及评论功能;内置文章归档和搜索模板;已作中文字体优化,内置3种字体方案可选。<br/>
4-
* 发布页:<a href="https://yayu.net/projects/typecho-textonly" target="_blank">https://yayu.net/projects/typecho-textonly</a>
5-
*
6-
* @package Text Only
7-
* @author Jeff Chen
8-
* @version 1.0.2
9-
* @link https://yayu.net/
10-
*/
11-
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
12-
$this->need('header.php'); ?>
13-
<?php if ($this->is('archive')) { ?>
14-
<div class="crumb"><strong>" <?php $this->archiveTitle(['category' => _t('%s'),'search' => _t('搜索结果'),'tag' => _t('标签:%s'),'author' => _t('作者:%s')], '', ''); ?> "</strong><?php if ( $this->is('search') ) { ?>关键词:<?php echo $this->archiveTitle('','',''); ?><?php } else { ?> 下的文章<?php } ?></div>
1+
<?php get_header();?>
2+
<?php if (is_archive()) { ?>
3+
<div class="crumb"><strong>" <?php single_cat_title(); ?> "</strong> 下共有 <?php echo esc_html($wp_query->found_posts); ?> 篇文章</div>
154
<?php } ?>
16-
<?php if ($this->have()): ?>
17-
<?php while ($this->next()): ?>
5+
<?php if ( have_posts() ) : ?>
6+
<?php while ( have_posts() ) : the_post();?>
187
<article>
19-
<h2 class="title"><a href="<?php $this->permalink(); ?>"><?php $this->title(); ?></a></h2>
20-
<?php $this->category(",", true, ""); echo " &middot; ";?><time datetime="<?php $this->date(); ?>"><?php $this->date(); ?></time>
21-
<div class="desc"><?php $this->excerpt(110, " ..."); ?></div>
8+
<h2 class="title"><a href="<?php the_permalink(); ?>"><?php if ( is_sticky() && is_home() ) : ?>🔝 <?php endif; ?><?php the_title(); ?></a></h2>
9+
<?php if ( 'post' == get_post_type()){ the_category(', '); echo " &middot; "; } ?><time datetime="<?php the_time('Y-m-d'); ?>"><?php the_date( get_option( 'date_format' ) ); ?></time>
10+
<div class="desc"><?php if ( has_excerpt() ) : ?><?php echo wp_trim_words( get_the_excerpt(),100); ?><?php else: ?><?php echo wp_trim_words( get_the_content(),100); ?><?php endif; ?></div>
2211
</article>
2312
<?php endwhile; ?>
24-
<?php if ( $this->is('archive') || $this->is('index') ) { ?>
13+
<?php if ( get_the_posts_pagination() ) : ?>
2514
<div class="post-pagination">
26-
<?php $this->pageNav('&nbsp;←&nbsp;', '&nbsp;→&nbsp;', '5', ''); ?>
15+
<?php
16+
the_posts_pagination( array(
17+
'mid_size' =>1,
18+
'prev_text' =>'<span>&larr;</span>',
19+
'next_text' =>'<span>&rarr;</span>',
20+
));
21+
?>
2722
</div>
28-
<?php }; ?>
29-
<?php else : ?><article><em>空空如也 ...</em></article><?php endif; ?>
30-
<?php $this->need('footer.php'); ?>
23+
<?php endif; ?>
24+
<?php endif; ?>
25+
<?php get_footer();?>

search.php

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
11
<?php
2-
/**
3-
* 搜索模板
4-
*
5-
* @package custom
6-
*/
7-
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
8-
<?php $this->need('header.php'); ?>
9-
<h1 class="title">搜索<?php if ( $this->is('search') ) : ?>关键词:<?php echo $this->archiveTitle('','',''); ?><?php endif; ?></h1>
10-
<form id="search" method="post" action="<?php $this->options->siteUrl(); ?>" role="search">
11-
<input type="text" id="s" name="s" class="text" value="<?php if ( $this->is('search') ) : ?><?php echo $this->archiveTitle('','',''); ?><?php endif; ?>" placeholder="<?php _e('输入关键字搜索'); ?>"/>
12-
<button type="submit" class="submit"><?php _e('搜索'); ?></button>
2+
/*
3+
Template Name: 搜索模板
4+
*/
5+
?>
6+
<?php get_header(); ?>
7+
<h1 class="title">搜索<?php if ( is_search()) : ?><?php printf( '关键词:%s' , '<span>&ldquo;' . get_search_query() . '&rdquo;</span>' ); ?><?php endif; ?></h1>
8+
<form action="/" method="get">
9+
<input type="text" name="s" id="search" value="<?php the_search_query(); ?>" placeholder="请输入你需要搜索的关键词" />
10+
<input type="submit" id="searchsubmit" value="搜索" />
1311
</form>
1412
<article>
15-
<?php if ( $this->is('search') && $this->have()) : ?>
16-
<div class="crumb">为你找到以下相关结果</div>
13+
<?php if ( is_search() && have_posts() ) : ?>
14+
<div class="crumb"><?php global $found_posts; printf( '为你找到 %s 条相关结果', $wp_query->found_posts ); ?></div>
1715
<ul class="results">
18-
<?php while ($this->next()): ?>
16+
<?php while ( have_posts() ) : the_post();?>
1917
<li>
20-
[ <?php $this->category(','); ?> ] <a href="<?php $this->permalink(); ?>" title="<?php $this->title() ?>"><?php $this->title() ?> <small><time datetime="<?php $this->date(); ?>"><?php $this->date(); ?></time></small></a>
18+
<?php if ( 'post' == get_post_type()){ echo "[ "; the_category(', '); echo " ] "; } ?><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute( $title_args ); ?>"><?php the_title_attribute( $title_args ); ?> <small><time datetime="<?php the_time('Y年m月d日');?>"><?php the_time('(Y/m/d)');?></time></small></a>
2119
</li>
2220
<?php endwhile; ?>
2321
</ul>
24-
<?php if ( $this->is('search') && $this->is('archive')) { ?>
22+
<?php if ( get_the_posts_pagination() ) : ?>
2523
<div class="post-pagination">
26-
<?php $this->pageNav('&nbsp;←&nbsp;', '&nbsp;→&nbsp;', '5', ''); ?>
24+
<?php
25+
the_posts_pagination( array(
26+
'mid_size' =>1,
27+
'prev_text' =>'<span>&larr;</span>',
28+
'next_text' =>'<span>&rarr;</span>',
29+
));
30+
?>
2731
</div>
28-
<?php }; ?>
29-
<?php elseif ( $this->is('search') && !$this->have()) : ?>
30-
抱歉,没有找到相关的结果,你可以在上方搜索栏中尝试其他关键词。
32+
<?php endif; ?>
33+
<?php elseif ( is_search() && ! have_posts() ) : ?>
34+
<?php global $found_posts; printf( '抱歉,没有找到相关的结果,你可以在上方搜索栏中尝试其他关键词。' , get_search_query() ); ?>
3135
<?php endif; ?>
3236
</article>
33-
<?php $this->need('footer.php'); ?>
37+
<?php get_footer(); ?>

style.css

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/*
2+
Theme Name: Text Only
3+
Theme URI: https://yayu.net/projects/wordpress-textonly
4+
Author: Jeff Chen
5+
Author URI: https://yayu.net/
6+
Description: Text Only 是一款 Typecho & WordPress 纯文本极简主题,黑白配色,对程序极简优化,主题无 JS 和图片文件载入。主题支持自定义背景、自定义菜单,保留搜索及评论功能;内置文章归档和搜索模板;已作中文字体优化,内置3种字体方案可选。
7+
Tags: blog, plaintext, one-column, full-width-template, minimalism, responsive, free
8+
Version: 1.0.0
9+
License: CC BY-NC-SA 4.0 DEED
10+
License URI: https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh-hans
11+
*/
12+
113
:root {
214
--width: 580px; /* 网页宽度 */
315
--font-yahei: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Ubuntu,"Helvetica Neue",Helvetica,Arial,"PingFangSC-Regular","Hiragino Sans GB","Lantinghei SC","Microsoft Yahei","Source Han Sans CN","WenQuanYi Micro Hei",SimSun,sans-serif;
@@ -38,7 +50,7 @@ img{max-width:100%;height:auto}
3850
code{font-family:monospace;padding:2px;background-color:var(--line-color);color:var(--code-color);border-radius:3px}
3951
blockquote{border-left:1px solid var(--gray-color);color:var(--code-color);padding-left:20px;font-style:italic}
4052
header,footer{padding:20px 0;color:var(--gray-color);}
41-
footer a{color:var(--sub-color)}
53+
footer a{color:var(--nav-color)}
4254
header{margin-bottom: 100px;padding-bottom:30px;border-bottom:1px solid var(--line-color);}
4355
main{margin-top: 50px;}
4456
.crumb{color: var(--gray-color);}
@@ -55,24 +67,29 @@ main .title{font-size:22px;padding-bottom: 5px;}
5567
.tags a{color:var(--gray-color);margin-right: 10px;}
5668
form > *:last-child{margin-bottom:0}
5769
label{font-size:0.9em;}
58-
input[type="text"],input[type="email"],input[type="url"],input[type="search"],textarea{background:transparent;border-radius:4px;border:1px solid var(--border-color);box-shadow:none;display:block;margin:0 0 15px 0;padding:10px;width:calc( 100% - 20px );max-width:calc(100% - 25px);}
70+
input[type="text"],input[type="email"],input[type="url"],input[type="search"],textarea{background:transparent;border-radius:4px;border:1px solid var(--border-color);box-shadow:none;display:block;margin:0 0 15px 0;padding:10px;width:100%}
5971
textarea{line-height:1.5;height:100px}
60-
textarea:focus,input[type="email"]:focus,input[type="search"]:focus,input[type="text"]:focus,input[type="url"]:focus{border:1px solid var(--gray-color);outline:0}
72+
textarea:focus,input[type="email"]:focus,input[type="search"]:focus,input[type="text"]:focus,input[type="url"]:focus{border:1px solid #999;outline:0}
6173
button,.button,input[type="button"],input[type="reset"],input[type="submit"]{background-color:var(--nav-color);border:none;border-radius:4px;color:#fff;display:inline-block;font-family:inherit;font-size:16px;margin:0;padding:8px 16px 10px;text-align:center}
6274
button:hover,.button:hover,input[type="button"]:hover,input[type="reset"]:hover,input[type="submit"]:hover{cursor:pointer;opacity:.7}
63-
.comment-list,.comment-list .comment-children{list-style: none;padding:0;margin-bottom:40px;}
64-
.comment-list{margin:30px 0;list-style: none;}
65-
.comment-list .comment-children{margin-left:50px}
75+
.commentlist,.commentlist .children{list-style: none;padding:0;margin-bottom:40px;}
76+
.comment{margin:30px 0;list-style: none;}
77+
.comment .comment{margin-left:50px}
6678
.comment-author cite{font-weight:bold;font-style:normal;}
6779
.comment-author .says,.comment-author .avatar{display:none}
68-
.comment-reply{border-bottom: 1px solid var(--gray-color);display: inline;padding-bottom:2px;}
69-
.respond h3,#comments h3{margin: 40px 0;padding-top: 30px; border-top: 1px dotted var(--border-color);}
70-
.respond p + p{margin-top:20px}
80+
.comment-respond,#comments{margin: 50px 0;padding-top: 30px; border-top: 1px dotted var(--border-color);}
81+
.logged-in .comment-respond .comment-reply-title{margin-bottom:20px}
82+
.comment-respond p + p{margin-top:20px}
83+
.comment-respond .comment-form-author,.comment-respond .comment-form-email{float:left;margin:10px 0;width:calc( 50% - 10px );max-width:calc(100% - 25px);}
84+
.comment-respond .comment-form-email{margin-left:20px}
85+
.comment-respond label{display:block}
86+
.comment-respond input,.comment-respond textarea{padding:10px;max-width:calc(100% - 25px);}
87+
.comment-respond input[type="checkbox"] + label{display:inline;font-size:14px;margin:0 0 0 5px}
88+
.closed{margin-top:20px}
7189
#cancel-comment-reply-link{float:right;font-weight: normal;}
72-
.post-pagination ol{list-style: none;display:inline-flex;padding: 0;}
73-
.linked-pagination span,.linked-pagination a:hover span,.post-pagination .page-numbers,.post-pagination ol a{width:35px;height:35px;line-height:35px;margin-right:8px;display:inline-block;text-align:center;border-radius:4px;}
74-
.linked-pagination span,.linked-pagination a:hover span,.post-pagination .pagination a:hover,.post-pagination .pagination .current,.post-pagination ol a:hover,.post-pagination ol .current a{background:#333;color:#fff}
75-
.linked-pagination a span,.post-pagination .page-numbers,.post-pagination ol a{background:#f8f8f8;color:#555}
90+
.linked-pagination span,.linked-pagination a:hover span,.post-pagination .page-numbers{width:35px;height:35px;line-height:35px;margin-right:8px;display:inline-block;text-align:center;border-radius:4px;}
91+
.linked-pagination span,.linked-pagination a:hover span,.post-pagination .pagination a:hover,.post-pagination .pagination .current{background:#333;color:#fff}
92+
.linked-pagination a span,.post-pagination .page-numbers{background:#f8f8f8;color:#555}
7693
.linked-pagination,.post-pagination{margin:80px 0 50px}
7794
.results{list-style:none;padding:0;margin:0;}
7895
.results li{margin:20px 0 0;}

0 commit comments

Comments
 (0)