start multi comic per blog stuff

This commit is contained in:
John Bintz 2009-07-15 21:55:28 -04:00
parent 82b01186ee
commit cb9d2b6ccc
8 changed files with 55 additions and 9 deletions

View File

@ -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;
}

View File

@ -74,6 +74,17 @@
<?php } ?>
</td>
</tr>
<tr>
<th scope="row">Use comic category pages as:</th>
<td>
<?php foreach (array(
"archive_list" => __("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) { ?>
<label><input type="radio" name="cp[category_page_usage]" value="<?php echo $value ?>" <?php echo ($this->comicpress->comicpress_options['category_page_usage'] == $value) ? 'checked="checked"' : "" ?> /> <?php echo $label ?></label><br />
<?php } ?>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="<?php _e("Submit Changes", 'comicpress') ?>" /></td>

View File

@ -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();
@ -21,6 +22,8 @@ class ComicPress {
var $comic_post_attachments_cache = array();
var $category_tree = array();
var $partial_paths = array();
/**
* Load ComicPress options.
*/

View File

@ -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,16 +50,45 @@ 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) {
foreach ($comicpress->partial_paths as $path) {
$target = $path . '/' . $partial . '.inc';
if (file_exists($target)) {
include($target);
return;
}
}
}
}
function in_comic_category() {

View File

@ -1,11 +1,11 @@
<?php
global $comicpress;
get_header();
comicpress_get_header();
if (have_posts()) {
the_post();
if (in_comic_category()) { include_partial('single-display-comic') }
if (in_comic_category()) { include_partial('single-display-comic'); }
}
rewind_posts();
@ -17,7 +17,7 @@
if (have_posts()) {
while (have_posts()) { the_post();
if (in_comic_category()) {
if ($comicpress->comicpress_options['comic_space'] == "comic_only")) {
if ($comicpress->comicpress_options['comic_space'] == "comic_only") {
include(get_template_directory() . '/partials/single-comic-post.inc');
}
} else {

View File

@ -0,0 +1 @@
this is my override blog header!

View File

@ -0,0 +1 @@
this is my override blog header!