-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunctions.php
More file actions
executable file
·36 lines (26 loc) · 909 Bytes
/
functions.php
File metadata and controls
executable file
·36 lines (26 loc) · 909 Bytes
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
<?php
function get_all_posts() {
$myposts = get_posts('numberposts=9999');
$last_post_year = '';
foreach ($myposts as $post) {
$post_url = get_permalink($post );
$post_year = date('Y', strtotime($post->post_date));
$post_title = $post->post_title;
if ($last_post_year != $post_year) {
if ($last_post_year == '') {
$output = $output . '<h2 class="post-listing-header">Recent Posts</h2>';
} else {
$output = $output . '</ul><h2 class="post-listing-header">' . $post_year . '</h2>';
}
$output = $output . '<ul class="posts">';
}
$last_post_year = $post_year;
$date_span = '<div class="post-date">' . date('d M Y', strtotime($post->post_date)) . '</div>';
$output = $output . get_archives_link($post_url, $post_title, 'html', $date_span);
}
if ($last_post_year != '') {
$output = $output . '</ul>';
}
echo $output;
}
?>