| 1 | 446c446 |
|---|
| 2 | < function get_calendar($initial = true) { |
|---|
| 3 | --- |
|---|
| 4 | > function get_calendar($initial = true, $cat_id = 0) { |
|---|
| 5 | 448a449,458 |
|---|
| 6 | > if ( ( $cat_id != 0 ) && ( intval( $cat_id ) == $cat_id ) ) { |
|---|
| 7 | > $cat_join = ", $wpdb->post2cat "; |
|---|
| 8 | > $cat_where = " and $wpdb->post2cat.post_id=$wpdb->posts.ID and $wpdb->post2cat.category_id=$cat_id"; |
|---|
| 9 | > } |
|---|
| 10 | > else { |
|---|
| 11 | > $cat_join = ''; |
|---|
| 12 | > $cat_where = ''; |
|---|
| 13 | > $cat_id = 0; |
|---|
| 14 | > } |
|---|
| 15 | > |
|---|
| 16 | 460c470 |
|---|
| 17 | < $gotsome = $wpdb->get_var("SELECT ID from $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1"); |
|---|
| 18 | --- |
|---|
| 19 | > $gotsome = $wpdb->get_var("SELECT ID from $wpdb->posts$cat_join WHERE post_type = 'post' AND post_status = 'publish' $cat_where ORDER BY post_date DESC LIMIT 1"); |
|---|
| 20 | 498c508 |
|---|
| 21 | < FROM $wpdb->posts |
|---|
| 22 | --- |
|---|
| 23 | > FROM $wpdb->posts$cat_join |
|---|
| 24 | 500c510 |
|---|
| 25 | < AND post_type = 'post' AND post_status = 'publish' |
|---|
| 26 | --- |
|---|
| 27 | > AND post_type = 'post' AND post_status = 'publish' $cat_where |
|---|
| 28 | 504c514 |
|---|
| 29 | < FROM $wpdb->posts |
|---|
| 30 | --- |
|---|
| 31 | > FROM $wpdb->posts$cat_join |
|---|
| 32 | 507c517 |
|---|
| 33 | < AND post_type = 'post' AND post_status = 'publish' |
|---|
| 34 | --- |
|---|
| 35 | > AND post_type = 'post' AND post_status = 'publish' $cat_where |
|---|
| 36 | 536c546 |
|---|
| 37 | < get_month_link($previous->year, $previous->month) . '" title="' . sprintf(__('View posts for %1$s %2$s'), $wp_locale->get_month($previous->month), |
|---|
| 38 | --- |
|---|
| 39 | > get_month_link($previous->year, $previous->month, $cat_id) . '" title="' . sprintf(__('View posts for %1$s %2$s'), $wp_locale->get_month($previous->month), |
|---|
| 40 | 546c556 |
|---|
| 41 | < get_month_link($next->year, $next->month) . '" title="' . sprintf(__('View posts for %1$s %2$s'), $wp_locale->get_month($next->month), |
|---|
| 42 | --- |
|---|
| 43 | > get_month_link($next->year, $next->month, $cat_id) . '" title="' . sprintf(__('View posts for %1$s %2$s'), $wp_locale->get_month($next->month), |
|---|
| 44 | 561c571 |
|---|
| 45 | < FROM $wpdb->posts WHERE MONTH(post_date) = '$thismonth' |
|---|
| 46 | --- |
|---|
| 47 | > FROM $wpdb->posts$cat_join WHERE MONTH(post_date) = '$thismonth' |
|---|
| 48 | 564c574 |
|---|
| 49 | < AND post_date < '" . current_time('mysql') . '\'', ARRAY_N); |
|---|
| 50 | --- |
|---|
| 51 | > AND post_date < '" . current_time('mysql') . "' $cat_where", ARRAY_N); |
|---|
| 52 | 580c590 |
|---|
| 53 | < ."FROM $wpdb->posts " |
|---|
| 54 | --- |
|---|
| 55 | > ."FROM $wpdb->posts$cat_join " |
|---|
| 56 | 584c594 |
|---|
| 57 | < ."AND post_type = 'post' AND post_status = 'publish'" |
|---|
| 58 | --- |
|---|
| 59 | > ."AND post_type = 'post' AND post_status = 'publish' $cat_where" |
|---|
| 60 | 619c629 |
|---|
| 61 | < echo '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"$ak_titles_for_day[$day]\">$day</a>"; |
|---|
| 62 | --- |
|---|
| 63 | > echo '<a href="' . get_day_link($thisyear, $thismonth, $day, $cat_id) . "\" title=\"$ak_titles_for_day[$day]\">$day</a>"; |
|---|