-
Notifications
You must be signed in to change notification settings - Fork 0
/
class.php
51 lines (35 loc) · 884 Bytes
/
class.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
<?php
if( !class_exists('TimeTunnel') ){
class TimeTunnel{
public function getPosts($c){
$postCount = $c;
$year = date('y');
$month = date('m');
$day = date('d');
$output = '';
$defaultArgs = array(
'post_type' => 'post',
'paged' => 1,
'posts_per_page'=> $postCount,
'date_query' => array(
'y' => $year,
'monthnum' => $month,
'day' => $day,
'before' => array(
'y'=> $year
),
),
);
$query = new WP_Query($defaultArgs);
if( $query->have_posts() )
while( $query->have_posts() )
{
$query->the_post();
$output .= '<ul class="timetunnel">';
$output .= '<li><a href="'. get_permalink() .'">'. get_the_title() .' - ('. get_the_time('M d, Y') .')</a></li>';
$output .= '</ul>';
}
return $output;
}
}
}