From 8ce616dac407714921e24285fdaa75edf5bfc967 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 13 Jul 2009 05:10:56 -0400 Subject: [PATCH] clean up archive comic calendar --- archive-comic-calendar.php | 168 +++++++++---------------------- functions.php | 1 - style/archive-comic-calendar.css | 52 ++++++++++ 3 files changed, 100 insertions(+), 121 deletions(-) create mode 100644 style/archive-comic-calendar.css diff --git a/archive-comic-calendar.php b/archive-comic-calendar.php index 514c571..1b2721e 100644 --- a/archive-comic-calendar.php +++ b/archive-comic-calendar.php @@ -2,160 +2,88 @@ /* Template Name: Comic Calendar Archive */ + +global $comicpress; ?> - + query('&showposts=1000&cat=' . $comicpress->get_all_comic_categories_as_cat_string() . '&year='.$archive_year); +while ($comic_archive_query->have_posts()) { + $comic_archive_query->the_post(); + $comic_archive_posts[get_the_time('d-m')] = array( + 'link' => get_permalink(), + 'title' => get_the_title() + ); +} +$post = $temp_post; + +$days_of_week = array(); +for ($i = 0; $i < 7; ++$i) { + $days_of_week[] = substr(date("l", gmmktime(0, 0, 0, 7, 13 + $i, 2009)), 0, 1); } -$tempPost = $post; -$comicArchive = new WP_Query(); $comicArchive->query('&showposts=1000&cat='.get_all_comic_categories_as_cat_string().'&year='.$archive_year); -while ($comicArchive->have_posts()) : $comicArchive->the_post(); - $calTitle = get_the_title(); - $calLink = get_permalink(); - $calDay = get_the_time('j'); - $calMonth = get_the_time('F'); - $calComic[$calMonth.$calDay] = array('link' => $calLink, 'title' => $calTitle); -endwhile; -$post = $tempPost; - -function leapYear($yr) { - if ($yr % 4 != 0) { - return 28; - } else { - if ($yr % 100 != 0) { - return 29; - } else { - if ($yr % 400 != 0) { - return 28; - } else { - return 29; - } - } - } -} -$leapYear = leapYear($archive_year); - -$month['1'] = array('month' => 'January', 'days' => '31'); -$month['2'] = array('month' => 'February', 'days' => $leapYear); -$month['3'] = array('month' => 'March', 'days' => '31'); -$month['4'] = array('month' => 'April', 'days' => '30'); -$month['5'] = array('month' => 'May', 'days' => '31'); -$month['6'] = array('month' => 'June', 'days' => '30'); -$month['7'] = array('month' => 'July', 'days' => '31'); -$month['8'] = array('month' => 'August', 'days' => '31'); -$month['9'] = array('month' => 'September', 'days' => '30'); -$month['10'] = array('month' => 'October', 'days' => '31'); -$month['11'] = array('month' => 'November', 'days' => '30'); -$month['12'] = array('month' => 'December', 'days' => '31'); - ?>
-

- +
| - get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date ASC"); + get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date ASC"); foreach ( $years as $year ) { - if ($year != (0) ) { ?> - | - + if ($year != 0 ) { ?> + | +
- -
-
- + +
"> +
+ +
+
- -
+ + + +
+
- - + +
- +
@@ -166,6 +94,6 @@ $month['12'] = array('month' => 'December', 'days' => '31');
- + \ No newline at end of file diff --git a/functions.php b/functions.php index 4140c6c..798d1b3 100644 --- a/functions.php +++ b/functions.php @@ -172,5 +172,4 @@ function widget_comicpress_archive_dropdown() { ?> diff --git a/style/archive-comic-calendar.css b/style/archive-comic-calendar.css new file mode 100644 index 0000000..d8b124c --- /dev/null +++ b/style/archive-comic-calendar.css @@ -0,0 +1,52 @@ +.cpcal-month { + width: 157px; + height: 138px; + padding: 5px 0 5px 5px; + margin: 0 8px 8px 0; + float: left; + border: 1px solid #000; + } +.cpcal-monthtitle { + width: 154px; + height: 16px; + padding: 0 0 5px 0; + text-align: center; + font-family: 'Georgia', serif; + font-variant: small-caps; + font-size: 16px; + line-height: 16px; + letter-spacing: -1px; + } +.cpcal-dayletter { + width: 20px; + height: 15px; + margin: 0 2px 2px 0; + display: block; + float: left; + text-align: center; + font-size: 10px; + line-height: 13px; + } +.cpcal-day { + width: 18px; + height: 13px; + margin: 0 2px 2px 0; + display: block; + float: left; + text-align: center; + font-size: 10px; + line-height: 13px; + border: 1px solid #000; + } + .cpcal-day a { + width: 18px; + height: 13px; + line-height: 13px; + display: block; + font-size: 12px; + font-weight: bold; + } + .cpcal-day a:hover { + color: #fff; + background: #000; + } \ No newline at end of file