comicpress-core/archive-comic-calendar.php

99 lines
3.1 KiB
PHP
Raw Normal View History

2009-06-13 11:58:02 +00:00
<?php
/*
Template Name: Comic Calendar Archive
*/
2009-07-13 09:10:56 +00:00
global $comicpress;
2009-06-13 11:58:02 +00:00
?>
<?php get_header() ?>
2009-07-13 09:10:56 +00:00
<link rel="stylesheet" href="<?php echo get_template_directory_uri() . '/style/archive-comic-calendar.css' ?>" type="text/css" />
2009-06-13 11:58:02 +00:00
<?php
$dayWidth = 22; //set to .cpcal-day total width in pixels including: width, left & right border, left & right margin, left & right padding
2009-07-13 09:10:56 +00:00
$archive_year = !empty($_GET['archive_year']) ? $_GET['archive_year'] : date('Y');
$temp_post = $post;
$comic_archive_posts = array();
$comic_archive_query = new WP_Query();
$comic_archive_query->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()
);
2009-06-13 11:58:02 +00:00
}
2009-07-13 09:10:56 +00:00
$post = $temp_post;
2009-06-13 11:58:02 +00:00
2009-07-13 09:10:56 +00:00
$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);
2009-06-13 11:58:02 +00:00
}
2009-07-13 09:10:56 +00:00
2009-06-13 11:58:02 +00:00
?>
2009-07-01 00:01:05 +00:00
<div id="content" class="narrowcolumn">
2009-06-13 11:58:02 +00:00
<div class="post-page-head"></div>
<div class="post-page">
<h2 class="pagetitle"><span class="archive-year"><?php echo $archive_year ?></span> <?php the_title() ?></h2>
<div class="entry">
2009-07-13 09:10:56 +00:00
<?php while (have_posts()) { the_post(); the_content(); } ?>
2009-06-13 11:58:02 +00:00
</div>
<div class="archive-yearlist">|
2009-07-13 09:10:56 +00:00
<?php
$years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date ASC");
2009-06-13 11:58:02 +00:00
foreach ( $years as $year ) {
2009-07-13 09:10:56 +00:00
if ($year != 0 ) { ?>
<a href="<?php echo add_query_arg('archive_year', $year) ?>"><strong><?php echo $year ?></strong></a> |
<?php }
}
?>
2009-06-13 11:58:02 +00:00
</div>
2009-07-13 09:10:56 +00:00
<?php for ($month = 1; $month <= 12; ++$month) {
$current_time = mktime(0, 0, 0, $month, 1, $archive_year); ?>
<div class="cpcal-month" id="<?php echo strtolower(date("F", $current_time)) ?>">
<div class="cpcal-monthtitle"><?php echo date("F", $current_time) . " " . $archive_year ?></div>
<?php foreach($days_of_week as $dow) { ?>
2009-06-13 11:58:02 +00:00
<div class="cpcal-dayletter"><?php echo $dow ?></div>
<?php } ?>
2009-07-13 09:10:56 +00:00
2009-06-13 11:58:02 +00:00
<div class="clear"></div>
2009-07-13 09:10:56 +00:00
<?php for ($day = 1, $end_day = date("t", $current_time); $day < $end_day; ++$day) {
$day_key = date('d-m', $current_time); ?>
<?php if ($day == 1) { ?>
<div style="width:<?php echo date('w', $current_time) * $dayWidth ?>px;height:15px;float:left;"></div>
2009-06-13 11:58:02 +00:00
<?php } ?>
2009-07-13 09:10:56 +00:00
2009-06-13 11:58:02 +00:00
<div class="cpcal-day">
2009-07-13 09:10:56 +00:00
<?php if (isset($comic_archive_posts[$day_key])) { ?>
<a href="<?php echo $comic_archive_posts[$day_key]['link'] ?>" title="<?php echo $comic_archive_posts[$day_key]['title'] ?>"><?php echo $day ?></a>
2009-06-13 11:58:02 +00:00
<?php } else {
2009-07-13 09:10:56 +00:00
echo $day . " ";
2009-06-13 11:58:02 +00:00
} ?>
</div>
2009-07-13 09:10:56 +00:00
<?php
$current_time += 86400;
} ?>
2009-06-13 11:58:02 +00:00
</div>
<?php } ?>
<br class="clear-margins" />
</div>
<div class="post-page-foot"></div>
</div>
2009-07-13 09:10:56 +00:00
<?php include(dirname(__FILE__) . '/sidebar.php') ?>
2009-06-13 11:58:02 +00:00
<?php get_footer() ?>