in a quasi-working state, don't use this build
This commit is contained in:
parent
4df37cd29b
commit
2e7028a72e
@ -6,20 +6,14 @@ Template Name: Comic Calendar Archive
|
|||||||
global $comicpress;
|
global $comicpress;
|
||||||
|
|
||||||
$comicpress->additional_stylesheets[] = '/style/archive-comic-calendar.css';
|
$comicpress->additional_stylesheets[] = '/style/archive-comic-calendar.css';
|
||||||
?>
|
|
||||||
|
|
||||||
<?php get_header() ?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$dayWidth = 22; //set to .cpcal-day total width in pixels including: width, left & right border, left & right margin, left & right padding
|
$dayWidth = 22; //set to .cpcal-day total width in pixels including: width, left & right border, left & right margin, left & right padding
|
||||||
|
|
||||||
$archive_year = !empty($_GET['archive_year']) ? $_GET['archive_year'] : date('Y');
|
$archive_year = !empty($_GET['archive_year']) ? (int)$_GET['archive_year'] : date('Y');
|
||||||
|
|
||||||
$temp_post = $post;
|
|
||||||
$comic_archive_posts = array();
|
$comic_archive_posts = array();
|
||||||
$comic_archive_query = new WP_Query();
|
$comic_archive_query = new WP_Query();
|
||||||
$comic_archive_query->query('&showposts=1000&cat=' . $comicpress->get_all_comic_categories_as_cat_string() . '&year='.$archive_year);
|
$comic_archive_query->query('showposts=1000&cat=' . $comicpress->get_all_comic_categories_as_cat_string() . '&year=' . $archive_year);
|
||||||
while ($comic_archive_query->have_posts()) {
|
while ($comic_archive_query->have_posts()) {
|
||||||
$comic_archive_query->the_post();
|
$comic_archive_query->the_post();
|
||||||
$comic_archive_posts[get_the_time('d-m')] = array(
|
$comic_archive_posts[get_the_time('d-m')] = array(
|
||||||
@ -27,29 +21,32 @@ while ($comic_archive_query->have_posts()) {
|
|||||||
'title' => get_the_title()
|
'title' => get_the_title()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$post = $temp_post;
|
|
||||||
|
|
||||||
$days_of_week = array();
|
$days_of_week = array();
|
||||||
for ($i = 0; $i < 7; ++$i) {
|
for ($i = 0; $i < 7; ++$i) {
|
||||||
$days_of_week[] = substr(date("l", gmmktime(0, 0, 0, 7, 13 + $i, 2009)), 0, 1);
|
$days_of_week[] = substr(date("l", gmmktime(0, 0, 0, 7, 13 + $i, 2009)), 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
ob_start();
|
||||||
|
|
||||||
<div id="content" class="narrowcolumn">
|
?>
|
||||||
<div class="post-page-head"></div>
|
<div class="post-page-head"></div>
|
||||||
<div class="post-page">
|
<div class="post-page">
|
||||||
<?php while (have_posts()) { the_post(); ?>
|
<?php
|
||||||
<h2 class="pagetitle"><span class="archive-year"><?php echo $archive_year ?></span> <?php the_title() ?></h2>
|
while (have_posts()) {
|
||||||
|
the_post(); ?>
|
||||||
|
<h2 class="pagetitle"><span class="archive-year"><?php echo $archive_year ?></span> <?php the_title() ?></h2>
|
||||||
|
|
||||||
<div class="entry"><?php the_content() ?></div>
|
<div class="entry"><?php the_content() ?></div>
|
||||||
<?php } ?>
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="archive-yearlist">|
|
<div class="archive-yearlist">|
|
||||||
<?php
|
<?php
|
||||||
$years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date ASC");
|
$years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date ASC");
|
||||||
foreach ( $years as $year ) {
|
foreach ( $years as $year ) {
|
||||||
if ($year != 0 ) { ?>
|
if ($year != 0) { ?>
|
||||||
<a href="<?php echo add_query_arg('archive_year', $year) ?>"><strong><?php echo $year ?></strong></a> |
|
<a href="<?php echo add_query_arg('archive_year', $year) ?>"><strong><?php echo $year ?></strong></a> |
|
||||||
<?php }
|
<?php }
|
||||||
}
|
}
|
||||||
@ -61,7 +58,7 @@ for ($i = 0; $i < 7; ++$i) {
|
|||||||
<div class="cpcal-month" id="<?php echo strtolower(date("F", $current_time)) ?>">
|
<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>
|
<div class="cpcal-monthtitle"><?php echo date("F", $current_time) . " " . $archive_year ?></div>
|
||||||
|
|
||||||
<?php foreach($days_of_week as $dow) { ?>
|
<?php foreach ($days_of_week as $dow) { ?>
|
||||||
<div class="cpcal-dayletter"><?php echo $dow ?></div>
|
<div class="cpcal-dayletter"><?php echo $dow ?></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
@ -90,9 +87,10 @@ for ($i = 0; $i < 7; ++$i) {
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="post-page-foot"></div>
|
<div class="post-page-foot"></div>
|
||||||
|
<?php
|
||||||
|
|
||||||
</div>
|
$content = ob_get_clean();
|
||||||
|
|
||||||
<?php get_sidebar() ?>
|
include(get_template_directory() . '/layouts/' . $comicpress->comicpress_options['layout']);
|
||||||
|
|
||||||
<?php get_footer() ?>
|
?>
|
@ -2,67 +2,13 @@
|
|||||||
/*
|
/*
|
||||||
Template Name: Comic Storyline with Thumbs
|
Template Name: Comic Storyline with Thumbs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
global $comicpress;
|
||||||
|
|
||||||
|
$comicpress->additional_stylesheets[] = '/style/archive-comic-calendar.css';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php get_header() ?>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
#storyline, #storyline ul {
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
#storyline li {
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
#storyline li img {
|
|
||||||
height: 50px;
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
#storyline li li img {
|
|
||||||
display: block;
|
|
||||||
float: right;
|
|
||||||
padding: 0 0 0 10px;
|
|
||||||
}
|
|
||||||
#storyline ul ul {
|
|
||||||
margin: 0 0 0 20px;
|
|
||||||
}
|
|
||||||
#storyline li li .storyline-title {
|
|
||||||
font-size: 24px;
|
|
||||||
font-weight: bold;
|
|
||||||
display: block;
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
#storyline li li .storyline-title:hover {
|
|
||||||
color: #900;
|
|
||||||
}
|
|
||||||
#storyline li li li a.storyline-title {
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
#storyline li li li li a.storyline-title {
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
.storyline-description {
|
|
||||||
font-size: 11px;
|
|
||||||
}
|
|
||||||
.storyline-foot {
|
|
||||||
clear: both;
|
|
||||||
margin: 0 0 10px 0;
|
|
||||||
height: 10px;
|
|
||||||
border-bottom: 4px solid #000;
|
|
||||||
}
|
|
||||||
#storyline li li .storyline-foot {
|
|
||||||
border-bottom: 2px solid #000;
|
|
||||||
}
|
|
||||||
#storyline li li li .storyline-foot {
|
|
||||||
border-bottom: 1px solid #000;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
|
||||||
<div id="content" class="narrowcolumn">
|
|
||||||
|
|
||||||
<div class="post-page-head"></div>
|
<div class="post-page-head"></div>
|
||||||
<div class="post-page">
|
<div class="post-page">
|
||||||
<?php while (have_posts()) : the_post(); ?>
|
<?php while (have_posts()) : the_post(); ?>
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
Template Name: Comic Archive
|
Template Name: Comic Archive
|
||||||
*/
|
*/
|
||||||
|
|
||||||
global $comicpress;
|
global $comicpress;
|
||||||
|
|
||||||
$comicpress->additional_stylesheets[] = '/style/archive-comic-calendar.css';
|
|
||||||
|
|
||||||
get_header();
|
|
||||||
|
get_header();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div id="content" class="narrowcolumn">
|
<div id="content" class="narrowcolumn">
|
||||||
|
@ -210,26 +210,28 @@ class ComicPress {
|
|||||||
* Get the first comic in a category.
|
* Get the first comic in a category.
|
||||||
*/
|
*/
|
||||||
function get_first_comic() {
|
function get_first_comic() {
|
||||||
return $this->get_terminal_post_in_category($this->get_all_comic_categories_as_cat_string());
|
return $this->get_terminal_post_in_category($category);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the last comic in a category.
|
* Get the last comic in a category.
|
||||||
*/
|
*/
|
||||||
function get_last_comic() {
|
function get_last_comic($category) {
|
||||||
return $this->get_terminal_post_in_category($this->get_all_comic_categories_as_cat_string(), false);
|
return $this->get_terminal_post_in_category($category, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the comics necessary to build the navigation.
|
* Get the comics necessary to build the navigation.
|
||||||
* @tested
|
* @tested
|
||||||
*/
|
*/
|
||||||
function get_nav_comics() {
|
function get_nav_comics($override_category_id = null) {
|
||||||
global $post;
|
global $post;
|
||||||
|
|
||||||
|
$category = is_numeric($override_category_id) ? $override_category_id : $this->comicpress_options['comic_category_id'];
|
||||||
|
|
||||||
$comic_posts = array();
|
$comic_posts = array();
|
||||||
foreach (array('first', 'last', 'previous', 'next') as $which) {
|
foreach (array('first', 'last', 'previous', 'next') as $which) {
|
||||||
$comic_posts[$which] = $this->{"get_${which}_comic"}();
|
$comic_posts[$which] = $this->{"get_${which}_comic"}($category);
|
||||||
}
|
}
|
||||||
|
|
||||||
$comic_posts['show_first'] = (trim($post->ID) != trim($comic_posts['first']->ID));
|
$comic_posts['show_first'] = (trim($post->ID) != trim($comic_posts['first']->ID));
|
||||||
|
50
single.php
50
single.php
@ -1,37 +1,39 @@
|
|||||||
<?php
|
<?php
|
||||||
global $comicpress;
|
global $comicpress, $nav_comics;
|
||||||
|
|
||||||
comicpress_get_header();
|
comicpress_get_header();
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
if (have_posts()) {
|
if (have_posts()) {
|
||||||
the_post();
|
the_post();
|
||||||
if (in_comic_category()) { include_partial('single-display-comic'); }
|
if (in_comic_category()) { include_partial('single-display-comic'); }
|
||||||
}
|
}
|
||||||
rewind_posts();
|
rewind_posts();
|
||||||
|
|
||||||
|
$comic = ob_get_clean();
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
$nav_comics = $comicpress->get_nav_comics();
|
$nav_comics = $comicpress->get_nav_comics();
|
||||||
?>
|
|
||||||
|
if (have_posts()) {
|
||||||
<div id="content" class="narrowcolumn">
|
while (have_posts()) { the_post();
|
||||||
<?php
|
if (in_comic_category()) {
|
||||||
if (have_posts()) {
|
if ($comicpress->comicpress_options['comic_space'] == "comic_only") {
|
||||||
while (have_posts()) { the_post();
|
include_partial('single-comic-post');
|
||||||
if (in_comic_category()) {
|
|
||||||
if ($comicpress->comicpress_options['comic_space'] == "comic_only") {
|
|
||||||
include(get_template_directory() . '/partials/single-comic-post.inc');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
include(get_template_directory() . '/partials/single-blog-post.inc');
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
comments_template();
|
include_partial('single-blog-post');
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
include(get_template_directory() . '/partials/single-no-matches.inc');
|
comments_template();
|
||||||
}
|
}
|
||||||
?>
|
} else {
|
||||||
</div>
|
include_partial('single-no-matches');
|
||||||
|
}
|
||||||
<?php get_sidebar() ?>
|
|
||||||
|
$content = ob_get_clean();
|
||||||
<?php get_footer() ?>
|
|
||||||
|
include(get_template_directory() . '/layouts/' . $comicpress->comicpress_options['layout']);
|
||||||
|
?>
|
63
style/archive-comic-storyline-thumbs.css
Normal file
63
style/archive-comic-storyline-thumbs.css
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#storyline, #storyline ul {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#storyline li {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#storyline li img {
|
||||||
|
height: 50px;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#storyline li li img {
|
||||||
|
display: block;
|
||||||
|
float: right;
|
||||||
|
padding: 0 0 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#storyline ul ul {
|
||||||
|
margin: 0 0 0 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#storyline li li .storyline-title {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: bold;
|
||||||
|
display: block;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#storyline li li .storyline-title:hover {
|
||||||
|
color: #900;
|
||||||
|
}
|
||||||
|
|
||||||
|
#storyline li li li a.storyline-title {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#storyline li li li li a.storyline-title {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.storyline-description {
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.storyline-foot {
|
||||||
|
clear: both;
|
||||||
|
margin: 0 0 10px 0;
|
||||||
|
height: 10px;
|
||||||
|
border-bottom: 4px solid #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#storyline li li .storyline-foot {
|
||||||
|
border-bottom: 2px solid #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#storyline li li li .storyline-foot {
|
||||||
|
border-bottom: 1px solid #000;
|
||||||
|
}
|
@ -171,6 +171,75 @@ class ComicPressTest extends PHPUnit_Framework_TestCase {
|
|||||||
$this->assertEquals($expected, $comic_posts["show_${show}"], $show);
|
$this->assertEquals($expected, $comic_posts["show_${show}"], $show);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function providerTestGetStorylineNavComics() {
|
||||||
|
return array(
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'1' => array(
|
||||||
|
'first' => 8,
|
||||||
|
'previous' => 9,
|
||||||
|
'next' => 11,
|
||||||
|
'last' => 12
|
||||||
|
),
|
||||||
|
'2' => array(
|
||||||
|
'first' => 10,
|
||||||
|
'previous' => false,
|
||||||
|
'next' => 15,
|
||||||
|
'last' => 15
|
||||||
|
),
|
||||||
|
'3' => array(
|
||||||
|
'first' => 20,
|
||||||
|
'previous' => 20,
|
||||||
|
'next' => false,
|
||||||
|
'last' => 21
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'1' => array(
|
||||||
|
'first' => true,
|
||||||
|
'previous' => true,
|
||||||
|
'next' => true,
|
||||||
|
'last' => true
|
||||||
|
),
|
||||||
|
'2' => array(
|
||||||
|
'first' => true,
|
||||||
|
'previous' => false,
|
||||||
|
'next' => false,
|
||||||
|
'last' => true
|
||||||
|
),
|
||||||
|
'3' => array(
|
||||||
|
'first' => true,
|
||||||
|
'previous' => false,
|
||||||
|
'next' => false,
|
||||||
|
'last' => true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider providerTestGetStorylineNavComics
|
||||||
|
*/
|
||||||
|
function testGetStorylineNavComics($category_info, $expected_category_results) {
|
||||||
|
$cp = $this->getMock('ComicPress', array('get_first_comic', 'get_last_comic', 'get_previous_comic', 'get_next_comic'));
|
||||||
|
foreach ($category_info as $category => $nav_comics) {
|
||||||
|
foreach ($nav_comics as $key => $result) {
|
||||||
|
$return = (is_numeric($result)) ? (object)array('ID' => $result) : false;
|
||||||
|
$cp->expects($this->once())->method("get_${key}_comic")->with($category)->will($this->returnValue($return));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$post = (is_numeric($given_post)) ? (object)array('ID' => $given_post) : false;
|
||||||
|
|
||||||
|
$comic_posts = $cp->get_nav_comics();
|
||||||
|
|
||||||
|
foreach ($expected_shows as $show => $expected) {
|
||||||
|
$this->assertEquals($expected, $comic_posts["show_${show}"], $show);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function providerTestGetLayoutChoices() {
|
function providerTestGetLayoutChoices() {
|
||||||
|
Loading…
Reference in New Issue
Block a user