-
Notifications
You must be signed in to change notification settings - Fork 127
/
Copy pathexcerpt-home.php
62 lines (36 loc) · 1.76 KB
/
excerpt-home.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
<?php
_the_ads('ad_list_header', 'list-header');
_the_leadpager();
echo '<div class="excerpts-wrapper">';
echo '<div class="excerpts">';
if( is_home() && empty($paged) && _hui('excerpt_hot_s') ){
$is_hotposts = true;
$limit_date = time() - _hui('excerpt_hot_date', 2)*86400;
$limit_date = date("Y-m-d H:i:s",$limit_date);
$limit = _hui('excerpt_hot_items', 2);
$min_views = _hui('excerpt_hot_minviews', 200);
$hotposts_number = 0;
$hotposts_ids = array();
$hotposts = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID WHERE post_date > '".$limit_date."' AND post_type = 'post' AND post_status = 'publish' AND meta_key = 'views' AND meta_value > {$min_views} ORDER BY views DESC LIMIT $limit");
if( !empty($hotposts) ){
foreach ($hotposts as $post) {
$hotposts_ids[] = get_the_ID();
$hotposts_number += 1;
include 'excerpt-item.php';
}
$args = array(
'ignore_sticky_posts' => 1,
'post__not_in' => $hotposts_ids,
'showposts' => get_option('posts_per_page', 20) - $hotposts_number
);
query_posts($args);
}
}
while ( have_posts() ) : the_post();
get_template_part( 'excerpt', 'item' );
endwhile;
wp_reset_query();
echo '</div>';
echo '</div>';
_paging();
_the_ads('ad_list_footer', 'list-footer');