forked from zhw2590582/Teahouse-Wordpress-Theme
/
format-aside.php
132 lines (111 loc) · 5.11 KB
/
format-aside.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
<?php
// 获取选项
$excerpt = cs_get_option( 'i_post_readmore' );
$qrcodes = cs_get_option( 'i_code_qrcodes' );
$qrcodes_img = cs_get_option( 'i_qrcodes_img' );
$font = cs_get_option( 'i_post_font' );
$view = cs_get_option( 'i_post_view' );
$sticky_img = cs_get_option( 'i_sticky_image' );
$featured = cs_get_option( 'i_post_featured' );
$meta_data = get_post_meta( get_the_ID(), 'aside_options', true );
$music = $meta_data['i_post_music'];
$player_id = cs_get_option( 'i_player_id' );
$player = cs_get_option('i_player');
$player_mobi = cs_get_option('i_player_mobi');
$author = cs_get_option( 'i_post_author' );
?>
<!-- 日志 -->
<div class="box-wrap">
<div class="box">
<header>
<?php if(is_single() || is_page()) { ?>
<h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1>
<?php } else { ?>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php } ?>
<?php if( !is_single()) { ?>
<?php } else { ?>
<ul class="top_meta">
<li class="mate-cat"><i class="fa fa-folder-open-o"></i><?php the_category(' '); ?></li>
<li class="mate-time"><i class="fa fa-clock-o"></i><?php echo '发表于 '.timeago( get_gmt_from_date(get_the_time('Y-m-d G:i:s')) ); ?></li>
<?php if ($view == true) { ?>
<li class="mate-view"><i class="fa fa-eye"></i><?php echo getPostViews(get_the_ID()); ?>次浏览</li>
<?php } ?>
<li class="mate-com"><i class="fa fa-comments-o"></i><a href="<?php the_permalink(); ?>#comments-title" title="comments"><?php comments_number(__('暂无评论','island'),__('1条评论','island'),__( '%条评论','island') );?></a></li>
<?php if ($author == true) { ?>
<li class="mate-author"><i class="fa fa-user"></i><?php the_author_posts_link(); ?></li>
<?php } ?>
<li><?php edit_post_link( __( '<i class="fa fa-edit"></i>编辑', 'island' ), '<div class="edit-link" alt="编辑文章" title="编辑文章">', '</div>' ); ?></li>
<div class="clearfix"></div>
</ul>
<?php } ?>
</header>
<?php if (is_single()) { ?>
<?php if( $featured == true) { ?>
<?php if ( has_post_thumbnail()) { ?>
<a class="featured-image" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php the_post_thumbnail( 'large-image' ); ?>
</a>
<?php }?>
<?php } ?>
<?php } else { ?>
<?php if ( has_post_thumbnail() && !is_mobile()) { ?>
<a class="featured-image" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php the_post_thumbnail( 'thumbnail' ); ?>
</a>
<?php }else{?>
<a class="featured-image" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php echo $sticky_img ?>"></a>
<?php } ?>
<?php } ?>
<div class="post-content">
<?php if( !is_single() ) { ?>
<ul class="top_meta">
<li class="mate-cat"><i class="fa fa-folder-open-o"></i><?php the_category(' '); ?></li>
<li class="mate-time"><i class="fa fa-clock-o"></i><?php echo '发表于 '.timeago( get_gmt_from_date(get_the_time('Y-m-d G:i:s')) ); ?></li>
<?php if ($view == true) { ?>
<li class="mate-view"><i class="fa fa-eye"></i><?php echo getPostViews(get_the_ID()); ?>次浏览</li>
<?php } ?>
<li class="mate-com"><i class="fa fa-comments-o"></i><a href="<?php the_permalink(); ?>#comments-title" title="comments"><?php comments_number(__('暂无评论','island'),__('1条评论','island'),__( '%条评论','island') );?></a></li>
<?php if ($author == true) { ?>
<li class="mate-author"><i class="fa fa-user"></i><?php the_author_posts_link(); ?></li>
<?php } ?>
<li><?php edit_post_link( __( '<i class="fa fa-edit"></i>编辑', 'island' ), '<div class="edit-link" alt="编辑文章" title="编辑文章">', '</div>' ); ?></li>
<div class="clearfix"></div>
</ul>
<?php } else { ?>
<?php } ?>
<div class="content">
<?php if(is_search() || is_archive()) { ?>
<div class="excerpt-more">
<?php the_excerpt(__( 'Read More','island')); ?>
</div>
<?php } else { ?>
<?php if(is_home()) { ?>
<?php if ($excerpt == true) {
the_excerpt(__( 'Read More','island'));
}else{
the_content(__( 'Read More','island'));
}?>
<?php } else { ?>
<?php the_content(__( 'Read More','island')); ?>
<?php } ?>
<?php } ?>
</div>
</div><!-- post content -->
<?php if (!empty($music) && $player == true) { ?>
<div class="clearfix"></div>
<div class="audio-wrapper">
<audio class="wp-audio-shortcode" preload="none" style="width: 100%">
<source type="audio/mpeg" src="<?php echo $music; ?>">
</audio>
</div>
<?php } ?>
<?php if ($player == true) {?>
<?php wp_enqueue_script('mediaelement'); ?>
<?php wp_enqueue_style('mediaelement'); ?>
<script>
jQuery(document).ready(function($) {
$('.audio-wrapper audio').mediaelementplayer();
});
</script>
<?php } ?>