-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle.php
108 lines (106 loc) · 4.9 KB
/
single.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php get_header();?>
<main class="site-content container">
<article class="post-content">
<div class="post-header">
<h1 class="post-title">
<?php the_title(); ?>
</h1>
<div class="post-info">
<span class="infoLeft"><i class="iconfont icon-book-read-line"></i>
<?php the_category(' ');?>
</span>
<span class="infoLeft"><i class="iconfont icon-calendar-2-line"></i>
<?php the_time('Y-m-d');?>
</span>
<span class="infoLeft"><i class="iconfont icon-user-3-line"></i>
<?php echo get_the_author_meta( 'display_name',$post->post_author);?>
</span>
<span class="opQrcode"><i class="iconfont icon-qr-code-line"></i>手机阅读</span>
<span<?php $reading_time=get_post_meta(get_the_ID(), 'reading_time' , true); if ($reading_time) {
echo '<p> <i class="iconfont icon-qr-code-line"></i>Estimated reading time: ' . $reading_time
. ' min</p>' ; } ?></span <div id="qrcode" class="flex">
</div>
</div>
</div>
<div class="post-main">
<?php while(have_posts()):the_post(); ?>
<?php the_content();?>
<?php endwhile;?>
</div>
</article>
<?php post_the_tags();?>
<div class="post-navigation flex">
<?php
$prev_post = get_previous_post();
if(!empty($prev_post)):?>
<div class="nav-box previous nav_box_previous">
<a href="<?php echo get_permalink($prev_post->ID);?>"
style="background-image: url(<?php echo list_the_post_thumbnail($prev_post->ID);?>);">
<div class="prev_info">
<span><i class="iconfont icon-arrow-left-s-line"></i>上一篇</span>
<p>
<?php echo $prev_post->post_title;?>
</p>
</div>
</a>
</div>
<?php endif;?>
<?php
$next_post = get_next_post();
if(!empty($next_post)):?>
<div class="nav-box next nav_box_next">
<a href="<?php echo get_permalink($next_post->ID);?>"
style="background-image: url(<?php echo list_the_post_thumbnail($next_post->ID);?>);">
<div class="prev_info">
<span>下一篇<i class="iconfont icon-arrow-right-s-line"></i></span>
<p>
<?php echo $next_post->post_title;?>
</p>
</div>
</a>
</div>
<?php endif;?>
</div>
<div class="related-post">
<span class="attach-title">相关推荐</span>
<?php
$categories = get_the_category();
foreach ($categories as $category) :
$posts = get_posts('numberposts=5&&orderby=rand&category='. $category->term_id);
foreach($posts as $post) : ?>
<article class="hasThumb flex">
<div class="article-content">
<h2 class="entry-title hidden">
<a class="hoverColor" href="<?php the_permalink();?>" title="<?php the_title();?>" rel="bookmark">
<?php the_title();?>
</a>
</h2>
<div class="entry-content hidden">
<?php the_excerpt();?>
</div>
<div class="entry-info">
<span class="infoLeft"><i class="iconfont icon-book-read-line"></i>
<?php the_category(' ');?>
</span>
<span class="rtime infoLeft"><i class="iconfont icon-calendar-2-line"></i>
<?php the_time('Y-m-d');?>
</span>
<span><i class="iconfont icon-user-3-line"></i>
<?php the_author();?>
</span>
</div>
</div>
<div class="entry-thumb">
<a class="focus hidden" href="<?php the_permalink();?>" title="<?php the_title();?>">
<img loading="auto" src="<?php echo list_the_post_thumbnail($post->ID,0);?>"
alt="<?php the_title();?>" title="<?php the_title();?>">
</a>
</div>
</article>
<?php endforeach;endforeach;?>
</div>
</main>
<script src="<?php echo get_template_directory_uri().'/style/js/qrcode.js'?>"></script>
<script>var qrcode = new QRCode("qrcode", { text: window.location.href, width: 128, height: 128, correctLevel: QRCode.CorrectLevel.H });</script>
<script>hljs.initHighlightingOnLoad(); hljs.initLineNumbersOnLoad(); function highlightjs() { $("code.hljs").each(function (i, block) { hljs.lineNumbersBlock(block) }) } document.addEventListener("highlightjs", highlightjs, false);</script>
<?php get_footer();