From cb9d2b6ccc1c6abe74d6401362c101b6e87ed192 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 15 Jul 2009 21:55:28 -0400 Subject: [PATCH] start multi comic per blog stuff --- addons/Core/Core.inc | 1 + addons/Core/partials/options-admin.inc | 11 ++++++ archive.php | 2 +- classes/ComicPress.inc | 7 ++-- functions.php | 35 +++++++++++++++++-- single.php | 6 ++-- .../guild-of-thieves/single-blog-header.inc | 1 + .../guild-of-thieves/single-display-comic.inc | 1 + 8 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 subthemes/guild-of-thieves/single-blog-header.inc create mode 100644 subthemes/guild-of-thieves/single-display-comic.inc diff --git a/addons/Core/Core.inc b/addons/Core/Core.inc index 24ae6b1..85a4df0 100644 --- a/addons/Core/Core.inc +++ b/addons/Core/Core.inc @@ -334,6 +334,7 @@ class ComicPressAddonCore extends ComicPressAddon { $this->comicpress->comicpress_options[$option] = (int)$_POST['cp'][$option]; break; case 'comic_space': + case 'category_page_usage': $this->comicpress->comicpress_options[$option] = $_POST['cp'][$option]; break; } diff --git a/addons/Core/partials/options-admin.inc b/addons/Core/partials/options-admin.inc index 5dbc07c..8f17f29 100644 --- a/addons/Core/partials/options-admin.inc +++ b/addons/Core/partials/options-admin.inc @@ -74,6 +74,17 @@ + + Use comic category pages as: + + __("The normal way, as a list of posts in that category", 'comicpress'), + "comic_frontpage" => __("As the front page to the comics in that category", 'comicpress') + ) as $value => $label) { ?> +
+ + +   " /> diff --git a/archive.php b/archive.php index f90f69d..f58e23a 100644 --- a/archive.php +++ b/archive.php @@ -7,7 +7,7 @@ // why can't wordpress allow for post date asc sorting out of the box... query_posts($query_string . '&order=asc'); - while (have_posts()) { + while (have_posts()) { the_post(); if (in_comic_category()) { diff --git a/classes/ComicPress.inc b/classes/ComicPress.inc index 8c8e7c4..235f5fc 100644 --- a/classes/ComicPress.inc +++ b/classes/ComicPress.inc @@ -12,7 +12,8 @@ class ComicPress { 'mini_dimensions' => '100x', 'category_order' => false, 'blogpost_count' => 10, - 'comic_space' => 'comic_only' + 'comic_space' => 'comic_only', + 'category_page_usage' => 'archive_list' ); var $additional_stylesheets = array(); @@ -20,7 +21,9 @@ class ComicPress { var $comic_post_attachments_cache = array(); var $category_tree = array(); - + + var $partial_paths = array(); + /** * Load ComicPress options. */ diff --git a/functions.php b/functions.php index 9589729..8bc51ab 100644 --- a/functions.php +++ b/functions.php @@ -4,7 +4,7 @@ add_action('init', '__comicpress_init'); function __comicpress_init() { - global $comicpress; + global $comicpress, $wp_query; if (current_user_can('edit_files')) { wp_cache_flush(); @@ -50,14 +50,43 @@ function __comicpress_init() { } } +function comicpress_get_header() { + global $post, $comicpress; + + if (!empty($post)) { + if (in_comic_category()) { + $category_ids = wp_get_post_categories($post->ID); + if (is_array($category_ids)) { + foreach ($category_ids as $id) { + $category = get_category($id); + if (!empty($category)) { + if (is_dir($target = get_template_directory() . '/subthemes/' . $category->slug)) { + $comicpress->partial_paths[] = $target; + } + } + } + } + } + } + + $comicpress->partial_paths[] = get_template_directory() . '/partials'; + + get_header(); +} + function include_partial($partials = '') { + global $comicpress; if (!is_array($partials)) { $partials = func_get_args(); } foreach ($partials as $partial) { - if (($result = include(get_template_directory() . '/partials/' . $partial . '.inc')) === true) { - return; + foreach ($comicpress->partial_paths as $path) { + $target = $path . '/' . $partial . '.inc'; + if (file_exists($target)) { + include($target); + return; + } } } } diff --git a/single.php b/single.php index 5005946..de61a94 100644 --- a/single.php +++ b/single.php @@ -1,11 +1,11 @@ comicpress_options['comic_space'] == "comic_only")) { + if ($comicpress->comicpress_options['comic_space'] == "comic_only") { include(get_template_directory() . '/partials/single-comic-post.inc'); } } else { diff --git a/subthemes/guild-of-thieves/single-blog-header.inc b/subthemes/guild-of-thieves/single-blog-header.inc new file mode 100644 index 0000000..29bc160 --- /dev/null +++ b/subthemes/guild-of-thieves/single-blog-header.inc @@ -0,0 +1 @@ +this is my override blog header! \ No newline at end of file diff --git a/subthemes/guild-of-thieves/single-display-comic.inc b/subthemes/guild-of-thieves/single-display-comic.inc new file mode 100644 index 0000000..29bc160 --- /dev/null +++ b/subthemes/guild-of-thieves/single-display-comic.inc @@ -0,0 +1 @@ +this is my override blog header! \ No newline at end of file