-
Notifications
You must be signed in to change notification settings - Fork 9
/
displaypost.php
306 lines (289 loc) · 12.3 KB
/
displaypost.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<?php
if ( isset( $_GET['latestblogpost'] ) )
add_action( 'template_redirect', 'comicpress_latest_blog_post_jump' );
function comicpress_latest_blog_post_jump() {
$catnum = 0;
if ( isset( $_GET['latestblogpost'] ) ) $catnum = (int) esc_attr( $_GET['latestblogpost'] );
if ( ! empty( $catnum ) ) {
$args = array(
'numberposts' => 1,
'post_type' => 'post',
'orderby' => 'post_date',
'order' => 'DESC',
'post_status' => 'publish',
'category__in' => array($catnum),
);
$qposts = get_posts( $args );
} else {
$args = array(
'numberposts' => 1,
'post_type' => 'post',
'orderby' => 'post_date',
'order' => 'DESC',
'post_status' => 'publish',
);
$qposts = get_posts( $args );
}
if ( is_array( $qposts ) ) {
$qposts = reset( $qposts );
wp_redirect( get_permalink( $qposts->ID ) );
} else {
wp_redirect( home_url() );
}
wp_reset_query();
exit;
}
if ( ! function_exists( 'comicpress_display_post_title' ) ) {
function comicpress_display_post_title() {
global $post, $wp_query;
$get_post_title = '';
if ( ( $post->post_type == 'page' ) && is_front_page() ) return; // Don't display the title on static home pages.
if ( ( comicpress_themeinfo( 'disable_page_titles' ) && is_page() ) || ( comicpress_themeinfo( 'disable_post_titles' ) && ! is_page() ) || (is_page( 'chat' ) || is_page( 'forum' ) ) ) return;
if ( is_page() ) {
$post_title = "<h2 class=\"page-title\">";
} else {
$post_title = "<h2 class=\"post-title\">";
}
if ( ( is_page_template( 'blog.php' ) || is_home() || is_front_page() || is_archive() || is_search() ) && ( $post->post_type != 'page') ) $post_title .= "<a href=\"".get_permalink()."\">";
$get_post_title .= get_the_title();
if ( ! $get_post_title ) $get_post_title = '( No Title )';
$post_title .= $get_post_title;
if ( ( is_page_template('blog.php') || is_home() || is_front_page() || is_archive() || is_search() ) && ( $post->post_type != 'page') ) $post_title .= "</a>";
$post_title .= "</h2>\r\n";
echo apply_filters( 'comicpress_display_post_title ', $post_title );
}
}
if ( ! function_exists('comicpress_display_post_thumbnail' ) ) {
function comicpress_display_post_thumbnail( $size = 'thumbnail' ) {
global $post, $wp_query;
if ( $post->post_type == 'post' ) {
$post_thumbnail = '';
$link = get_post_meta( $post->ID, 'link', true );
if ( empty( $link ) ) $link = get_permalink();
if ( has_post_thumbnail() ) {
if ( is_home() ) {
$post_thumbnail = '<div class="post-image"><center><a href="'.$link.'" rel="featured-image" title="Link to ' . get_the_title() . '">' . get_the_post_thumbnail( $post->ID, $size ) . '</a></center></div>'."\r\n";
} else
$post_thumbnail = '<div class="post-image"><center>' . get_the_post_thumbnail( $post->ID, $size ) . '</center></div>'."\r\n";
} else {
$url_image = get_post_meta($post->ID, 'featured-image', true);
if ( ! empty( $url_image ) ) $post_thumbnail = '<div class="post-image"><center><a href="' . $link . '" rel="featured-image" title="Link to "' . get_the_title() . '"><img src="' . $url_image . '" title="' . get_the_title() .'" alt="' . get_the_title() . '"></a></center></div>' . "\r\n";
}
echo apply_filters( 'comicpress_display_post_thumbnail', $post_thumbnail );
}
}
}
if ( ! function_exists( 'comicpress_display_author_gravatar' ) ) {
function comicpress_display_author_gravatar() {
global $post, $wp_query, $is_IE;
if ( is_page() ) return;
if ( comicpress_themeinfo( 'enable_post_author_gravatar' ) ) {
$author_get_gravatar = get_avatar(get_the_author_meta( 'email '), 82, comicpress_random_default_avatar( get_the_author_meta(' email' ), get_the_author_meta( 'display_name' ) ) );
if ( ! $is_IE ) $author_get_gravatar = str_replace( 'photo', 'photo instant nocorner itxtalt', $author_get_gravatar );
$author_gravatar = "<div class=\"post-author-gravatar\">" . $author_get_gravatar . "</div>\r\n";
echo apply_filters( 'comicpress_display_author_gravatar', $author_gravatar );
}
}
}
if ( ! function_exists('comicpress_display_post_calendar' ) ) {
function comicpress_display_post_calendar() {
global $post, $wp_query;
if ( is_page() ) return;
if ( comicpress_themeinfo( 'enable_post_calendar') ) {
$post_calendar = "<div class=\"post-calendar-date\"><div class=\"calendar-date\"><span>" . get_the_time(' M' ) . "</span>" . get_the_time( 'd' ) . "</div></div>\r\n";
echo apply_filters( 'comicpress_display_post_calendar', $post_calendar );
}
}
}
if ( !function_exists( 'comicpress_display_post_author' ) ) {
function comicpress_display_post_author() {
global $post, $authordata;
if ( ! comicpress_themeinfo( 'disable_author_info_in_posts') ) {
$post_author = '<span class="post-author">'.__( 'by', 'comicpress' ).' <a href="' . get_author_posts_url( $authordata->ID, $authordata->user_nicename ) .'" rel="author">' . get_the_author().'</a></span>' . "\r\n";
echo apply_filters( 'comicpress_display_post_author', $post_author );
}
}
}
if ( ! function_exists( 'comicpress_display_post_date' ) ) {
function comicpress_display_post_date() {
global $post;
if ( ! comicpress_themeinfo( 'disable_date_info_in_posts' ) ) {
$post_date = "<span class=\"posted-on\">".__( 'on ', 'comicpress' ) . "</span><span class=\"post-date\">" . get_the_date( get_option( 'date_format' ) ) . "</span>\r\n";
echo apply_filters( 'comicpress_display_post_date', $post_date );
}
}
}
if ( ! function_exists( 'comicpress_display_post_time' ) ) {
function comicpress_display_post_time() {
global $post;
if ( ! comicpress_themeinfo( 'disable_date_info_in_posts') && ! comicpress_themeinfo( 'disable_posted_at_time_in_posts' ) ) {
$post_time = "<span class=\"posted-at\">" . __( 'at ', 'comicpress' ) . "</span><span class=\"post-time\">" . get_the_time( get_option( 'time_format' ) ) . "</span>\r\n";
echo apply_filters( 'comicpress_display_post_time', $post_time );
}
}
}
if ( ! function_exists( 'comicpress_display_modified_date_time' ) ) {
function comicpress_display_modified_date_time() {
global $post;
if ( ! comicpress_themeinfo( 'disable_date_info_in_posts' ) && comicpress_themeinfo( 'enable_last_modified_in_posts' ) ) {
$u_time = get_the_time( 'U' );
$u_modified_time = get_the_modified_time( 'U' );
if ( $u_modified_time != $u_time ) {
$post_date_time = '<span class="posted-last-modified"> ' . __( 'and modified on', 'comicpress' ) . ' ' . get_the_modified_date( get_option( 'date_format' ) ) . '. ';
if ( ! comicpress_themeinfo( 'disable_posted_at_time_in_posts' ) ) $post_date_time .= '<span class="posted-last-modified-time"> ' . __( 'at', 'comicpress' ).' ' . get_the_modified_time( get_option( 'time_format' ) ) . '</span>'."\r\n";
echo apply_filters( 'comicpress_display_modified_date_time', $post_date_time );
}
}
}
}
if ( ! function_exists( 'comicpress_display_post_category' ) ) {
function comicpress_display_post_category() {
global $post;
$post_category = '';
if ( ! comicpress_is_bbpress() && ! comicpress_themeinfo( 'disable_categories_in_posts' ) && !is_attachment() && ( $post->post_type == 'post' ) ) {
$post_category = "<div class=\"post-cat\">" . __( 'Posted In:', 'comicpress' ) . ' ' . get_the_category_list( ', ' ) . "</div>\r\n";
}
echo apply_filters( 'comicpress_display_post_category', $post_category );
}
}
if ( ! function_exists( 'comicpress_display_post_tags' ) ) {
function comicpress_display_post_tags() {
global $post;
if ( ! comicpress_themeinfo( 'disable_tags_in_posts' ) ) {
$post_tags = "<div class=\"post-tags\">" . get_the_tag_list( __( '└ Tags: ', 'comicpress' ), ', ', '<br />' ) . "</div>\r\n";
echo apply_filters( 'comicpress_display_post_tags', $post_tags );
}
}
}
if ( ! function_exists( 'comicpress_display_comment_link' ) ) {
function comicpress_display_comment_link() {
global $post;
if ( $post->comment_status == 'open' && ! is_singular() ) {
?>
<div class="comment-link">
<?php comments_popup_link( '<span class="comment-balloon comment-balloon-empty"> </span>' . __( 'Comment ', 'comicpress' ), '<span class="comment-balloon">1</span> ' .__( 'Comment', 'comicpress' ), '<span class="comment-balloon">%</span> ' . __( 'Comments', 'comicpress' ) ); ?>
</div>
<?php
}
}
}
if ( ! function_exists( 'comicpress_display_blog_navigation' ) ) {
function comicpress_display_blog_navigation() {
global $post, $wp_query;
if ( comicpress_themeinfo( 'enable_comments_on_homepage' ) && ( comicpress_themeinfo( 'home_post_count' ) == '1' ) ) {
$temp_single = $wp_query -> is_single;
$wp_query -> is_single = true;
}
if ( is_single() && ! is_page() && ! is_archive() && ! is_search() && ( $post->post_type == 'post' ) ) {
?>
<div class="blognav">
<?php previous_post_link( '<span class="blognav-prev">%link</span>',__( '‹ Prev', 'comicpress' ), false ); ?>
<?php next_post_link( '<span class="blognav-next">%link</span>',__( 'Next ›', 'comicpress' ), false ); ?>
<div class="clear"></div>
</div>
<?php
}
if ( comicpress_themeinfo( 'enable_comments_on_homepage' ) && ( comicpress_themeinfo( 'home_post_count' ) == '1') ) {
$wp_query -> is_single = $temp_single;
}
}
}
if ( ! function_exists( 'comicpress_display_the_content' ) ) {
function comicpress_display_the_content() {
global $post, $wp_query;
if ( ( is_archive() || is_search() ) && ( comicpress_themeinfo( 'excerpt_or_content_in_archive' ) == 'excerpt' ) && ! comicpress_is_bbpress() ) {
do_action( 'comicpress-display-the-content-before' );
the_excerpt();
do_action( 'comicpress-display-the-content-after' );
} else {
if ( ! is_single() ) {
global $more; $more = 0;
}
do_action( 'comicpress-display-the-content-before' );
the_content( __( '↓ Read the rest of this entry...', 'comicpress' ) );
do_action( 'comicpress-display-the-content-after' );
}
}
}
if ( ! function_exists( 'comicpress_display_post' ) ) {
function comicpress_display_post() {
global $post, $wp_query;
if ( ! comicpress_is_bbpress() ) comicpress_display_blog_navigation();
?>
<div <?php post_class(); ?>>
<?php comicpress_display_post_thumbnail(); ?>
<div class="post-head">
<?php do_action( 'comicpress-post-head' ); ?>
</div>
<div class="post-content">
<div class="post-info">
<?php
if ( ! comicpress_is_bbpress() ) comicpress_display_author_gravatar();
if ( ! comicpress_is_bbpress() ) comicpress_display_post_calendar();
if ( is_sticky() ) {
?>
<div class="sticky-image">Featured Post</div>
<?php
}
if ( function_exists( 'comicpress_show_mood_in_post' ) ) comicpress_show_mood_in_post();
?>
<div class="post-text">
<?php
comicpress_display_post_title();
if ( ! is_page() ) {
comicpress_display_post_author();
comicpress_display_post_date();
comicpress_display_post_time();
comicpress_display_modified_date_time();
if ( $post->post_type == 'post' ) {
edit_post_link( __( 'Edit', 'comicpress' ), ' <span class="post-edit">', '</span>');
}
comicpress_display_post_category();
/* Integrate the WP-Plugin: WP-PostRatings */
if ( function_exists( 'the_ratings' ) && $post->post_type == 'post' ) { the_ratings();
}
do_action( 'comicpress-post-info' );
do_action( 'comic-post-info' );
}
?>
</div>
</div>
<div class="clear"></div>
<div class="entry">
<?php comicpress_display_the_content(); ?>
<div class="clear"></div>
<?php do_action( 'comic-transcript' ); ?>
</div>
<?php
wp_link_pages( array(
'before' => '<div class="linkpages"><span class="linkpages-pagetext">Pages:</span> ',
'after' => '</div>',
'next_or_number' => 'number',
)
);
?>
<div class="clear"></div>
<?php
if ( ! is_page() ) {
?>
<div class="post-extras">
<?php
comicpress_display_post_tags();
do_action( 'comicpress-post-extras' );
comicpress_display_comment_link();
?>
<div class="clear"></div>
</div>
<?php
} else edit_post_link( __( 'Edit this page.', 'comicpress' ), '', '');
?>
</div>
<div class="post-foot">
<?php do_action('comic-post-foot'); ?><?php do_action('comicpress-post-foot'); ?></div>
</div>
<?php
do_action( 'comic-post-extras' );
comments_template( '', true );
}
}
?>