-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_rss_template.php
46 lines (34 loc) · 1.35 KB
/
custom_rss_template.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
<form method="GET" action="/custom-rss">
<?php
//Categories
echo '<h3>Choose by Category</h3>';
// get all the categories
$listCat = get_categories(); // include any categories that should be excluded here
// for each category, loop through the following, creating a checkbox input
foreach ($listCat as $cat) {
$checkbox = '<p class="basic"><input name="category[]" type="checkbox" value="'.$cat->cat_ID.'" />';
$checkbox .= '<label>'.$cat->cat_name.'</label></p>';
echo $checkbox;
}
//Authors
echo '<h3>Choose by Author</h3>';
// get all of the blog's authors
$listAuthor = get_users_of_blog();
//User must have posted since following date to appear - year month day
$cutOffDate = 20100101;
// loop through each author and outut a checkbox
foreach ($listAuthor as $author) {
$user = get_userdata($author->user_id);
$lastpost = query_posts('author='.$user->ID.'&posts_per_page=1');
foreach ($lastpost as $post) {
$lastPostDate = mysql2date('Ymd', $post->post_date);
}
if($lastPostDate > $cutOffDate) {
$checkbox = '<p class="basic"><input name="byline[]" type="checkbox" value="'.$user->ID.'" />';
$checkbox .= '<label>'.$user->user_firstname . ' ' . $user->user_lastname.'</label></p>';
echo $checkbox;
}
}
?>
<input type="submit" value="submit" id="submit-custom-rss" />
</form>