-
Notifications
You must be signed in to change notification settings - Fork 64
/
archive.php
executable file
·161 lines (161 loc) · 9.79 KB
/
archive.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php
/**
* ┌─┐┬ ┬┌─┐┬ ┬┌┐┌┌─┐┌─┐┌┐┌┌─┐ ┌─┐┌─┐┌┬┐
* └─┐├─┤├─┤││││││┌─┘├┤ ││││ ┬ │ │ ││││
* └─┘┴ ┴┴ ┴└┴┘┘└┘└─┘└─┘┘└┘└─┘o└─┘└─┘┴ ┴
*
* @package WordPress
* @Theme Memory
*
* @author admin@shawnzeng.com
* @link https://shawnzeng.com
*/
get_header(); ?>
<div id="main">
<div id="main-part">
<?php if(function_exists('memory_breadcrumbs') and cs_get_option( 'memory_breadcrumbs' )==1) { ?>
<div class="memory-item breadcrumbs">当前位置:
<?php memory_breadcrumbs();?>
</div>
<?php } ?>
<ul class="posts-list">
<?php if ( have_posts() ) { ?>
<?php while ( have_posts() ) { the_post(); global $post; ?>
<?php if( $post->post_type== 'post' ) { ?>
<li class="memory-item">
<article class="post post-type">
<?php if( is_sticky() ) _e('<div class="set-top"><div>置顶</div></div>','Memory'); ?>
<header class="post-type-header">
<?php if ( has_post_thumbnail() ) { ?>
<div class="thumbnail-link" style="background-image:url('<?php echo get_the_post_thumbnail_url(get_the_ID(),'full'); ?>');"></div>
<?php } else { ?>
<div class="thumbnail-link" style="background-image:url('<?php $unique_id = cs_get_option('memory_post_image'); $attachment = wp_get_attachment_image_src( $unique_id, 'full' ); $image_url = ($attachment) ? $attachment[0] : $unique_id; print_r($image_url);?>')"></div>
<?php } ?>
<div class="post-relative">
<?php echo get_avatar( get_the_author_meta( 'ID' ) ); ?>
<span class="post-type-author"><?php echo the_author_posts_link(); ?> <i class="memory memory-certify"></i><span class="publish-time"> - <?php echo human_time_diff(get_the_time('U'), current_time('timestamp')); _e('前'); ?></span>
</span>
<h3 class="post-type-title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
</div>
</header>
<div class="post-main post-type-main">
<div class="post-content">
<div class="post-tag"><?php the_tags('', ' ', ''); ?></div>
<div class="post-excerpt"><?php Memory_excerpt( 160, '……' ); ?></div>
<div class="post-category"><?php _e('来自分类:');the_category( ' / ' ); ?></div>
</div>
</div>
<div class="post-footer">
<span class="post-view">
<i class="memory memory-view"></i> <?php echo getPostViews(get_the_ID()); ?>
</span>
<span class="post-comments">
<i class="memory memory-comment"></i> <?php if ( post_password_required() ) { echo '<a>密码保护</a>'; } else { comments_popup_link('0', '1', '%', '', '评论已关闭'); } ?>
</span>
<span class="post-like">
<a href="javascript:;" data-action="memory_like" data-id="<?php the_ID(); ?>" class="like<?php if(isset($_COOKIE['memory_like_'.$post->ID])) echo ' have-like';?>">
<span class="like-count"><?php if( get_post_meta($post->ID,'memory_like',true) ){ echo get_post_meta($post->ID,'memory_like',true); } else { echo '0'; }?></span>
</a>
</span>
<span class="post-readmore">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<i class="memory memory-more-o"></i> 阅读
</a>
</span>
</div>
</article>
</li>
<?php } else if( $post->post_type== 'shuoshuo' ) { ?>
<li class="memory-item">
<article class="shuoshuo post-type">
<?php if( is_sticky() ) _e('<div class="set-top">置顶</div>','Memory'); ?>
<header class="post-type-header">
<div class="post-relative">
<?php echo get_avatar( get_the_author_meta( 'ID' ) ); ?>
<span class="post-type-author"><?php echo the_author_posts_link(); ?> <i class="memory memory-certify"></i><span class="publish-time"> - <?php echo human_time_diff(get_the_time('U'), current_time('timestamp')); _e('前'); ?></span>
</span>
<span class="post-publish">发布了一条说说</span>
</div>
</header>
<div class="post-main post-type-main">
<div class="post-content">
<div class="post-tag post-content"><?php the_tags('', ' ', ''); the_content(); ?></div>
</div>
</div>
<div class="post-footer">
<span class="post-view">
<i class="memory memory-view"></i> <?php echo getPostViews(get_the_ID()); ?>
</span>
<span class="post-comments">
<i class="memory memory-comment"></i> <?php if ( post_password_required() ) { echo '<a>密码保护</a>'; } else { comments_popup_link('0', '1', '%', '', '评论已关闭'); } ?>
</span>
<span class="post-like">
<a href="javascript:;" data-action="memory_like" data-id="<?php the_ID(); ?>" class="like<?php if(isset($_COOKIE['memory_like_'.$post->ID])) echo ' have-like';?>">
<span class="like-count"><?php if( get_post_meta($post->ID,'memory_like',true) ){ echo get_post_meta($post->ID,'memory_like',true); } else { echo '0'; }?></span>
</a>
</span>
<span class="post-readmore">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<i class="memory memory-more-o"></i> 阅读
</a>
</span>
</div>
</article>
</li>
<?php } else if ( $post->post_type== 'douban' ) { ?>
<li>
<article class="art">
<?php if( is_sticky() ) echo '<div class="set-top"><div>置顶</div></div>'; ?>
<header class="art-header">
<?php echo get_avatar( get_the_author_meta( 'ID' ) ); ?>
<h3 class="article-author"><?php echo the_author_posts_link(); ?>
<i class="memory memory-certify"></i>
<span class="normal">发布了一篇<?php if( strlen(get_post_meta( get_the_ID(), '_douban_id', true )) < 9 ) { echo '影评'; } else { echo '书评'; } ?></span>
</h3>
<h3 class="article-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h3>
<div class="art-info">
<span class="art-info-date">
<i class="memory memory-calendar"></i> <?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . '前'; ?>
</span> •
<span class="art-info-view">
<i class="memory memory-view"></i> <?php echo getPostViews(get_the_ID()); ?>
</span> •
<span class="art-info-comment">
<i class="memory memory-comment-1"></i> <?php comments_popup_link('0', '1', '%', '', '评论已关闭'); ?>
</span>
</div>
</header>
<div class="art-main">
<?php echo '<div id="db'.get_post_meta( get_the_ID(), '_douban_id', true ).'" db-id="'.get_post_meta( get_the_ID(), '_douban_id', true ).'" db-score="'.get_post_meta( get_the_ID(), '_douban_score', true ).'" class="douban_item post-preview"></div>'; ?>
<div class="article-info info-index">
<span class="post-like">
<a href="javascript:;" data-action="ding" data-id="<?php the_ID(); ?>" class="favorite<?php if(isset($_COOKIE['memory_ding_'.$post->ID])) echo ' done';?>"><span class="count">
<?php if( get_post_meta($post->ID,'memory_ding',true) ){
echo get_post_meta($post->ID,'memory_ding',true);
} else {
echo '0';
}?></span>
</a>
</span>
<span class="art-info-readmore">
<a href="<?php the_permalink(); ?>">
<i class="memory memory-more-o"></i> 阅读全文
</a>
</span>
</div>
</div>
</article>
</li>
<?php } ?>
<?php } ?>
<?php } ?>
</ul>
<div id="index-pagination">
<?php if( get_next_posts_link() ) { ?>
<?php next_posts_link(__('<div class="page-more">(。・`ω´・)点我加载更多</div>')); ?>
<?php } else { echo '<div class="page-more">你已到达了世界的尽头(。・`ω´・)!</div>'; } ?>
</div>
</div>
<?php get_sidebar(); ?>
</div>
<?php get_footer();