From 82b01186eed98da61bf1d09e769cda74f4b3b1a0 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 15 Jul 2009 21:34:34 -0400 Subject: [PATCH] add comic space insertion type --- addons/Core/Core.inc | 19 ++++++++++++++++--- addons/Core/partials/options-admin.inc | 11 +++++++++++ archive.php | 10 +++++----- classes/ComicPress.inc | 3 ++- functions.php | 12 ++++++++++++ index.php | 14 +++++--------- partials/index-blog-header.inc | 1 + partials/index-display-comic.inc | 3 +++ partials/single-display-comic.inc | 3 +++ search.php | 10 +++++----- single.php | 10 ++++------ .../guild-of-thieves/index-blog-header.inc | 1 + 12 files changed, 68 insertions(+), 29 deletions(-) create mode 100644 partials/index-blog-header.inc create mode 100644 partials/index-display-comic.inc create mode 100644 partials/single-display-comic.inc create mode 100644 subthemes/guild-of-thieves/index-blog-header.inc diff --git a/addons/Core/Core.inc b/addons/Core/Core.inc index 4fa9153..24ae6b1 100644 --- a/addons/Core/Core.inc +++ b/addons/Core/Core.inc @@ -2,7 +2,7 @@ class ComicPressAddonCore extends ComicPressAddon { function init($comicpress) { - add_action('admin_init', array(&$this, 'setup_admin_interface')); + add_action('admin_menu', array(&$this, 'setup_admin_interface')); add_filter('attachment_fields_to_edit', array(&$this, 'setup_comic_metadata_buttons'), 10, 2); add_action('show_comic', array(&$this, 'show_comic'), 1, 1); add_action('show_archive', array(&$this, 'show_archive'), 1, 1); @@ -54,8 +54,18 @@ class ComicPressAddonCore extends ComicPressAddon { global $post; $post_to_use = (is_null($override_post)) ? $this->comicpress->get_last_comic() : $post; - $comic_post = new ComicPressComicPost($post_to_use, &$this->comicpress); - $comic_post->{$method}(); + switch ($this->comicpress->comicpress_options['comic_space']) { + case "comic_only": + $comic_post = new ComicPressComicPost($post_to_use, &$this->comicpress); + $comic_post->{$method}(); + break; + case "post_content": + $t = $post; + $post = $post_to_use; + include_partial('index-blog-post'); + $post = $t; + break; + } } function show_comic($override_post = null) { @@ -323,6 +333,9 @@ class ComicPressAddonCore extends ComicPressAddon { case 'blogpost_count': $this->comicpress->comicpress_options[$option] = (int)$_POST['cp'][$option]; break; + case 'comic_space': + $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 f25e8f9..5dbc07c 100644 --- a/addons/Core/partials/options-admin.inc +++ b/addons/Core/partials/options-admin.inc @@ -63,6 +63,17 @@

(categories can be modified on the Posts -> Categories page)

+ + Insert into comic space: + + __("The comic only, with post content below", 'comicpress'), + "post_content" => __("The post content", 'comicpress') + ) as $value => $label) { ?> +
+ + +   " /> diff --git a/archive.php b/archive.php index 4243a14..f90f69d 100644 --- a/archive.php +++ b/archive.php @@ -2,7 +2,7 @@
diff --git a/classes/ComicPress.inc b/classes/ComicPress.inc index f576abc..8c8e7c4 100644 --- a/classes/ComicPress.inc +++ b/classes/ComicPress.inc @@ -11,7 +11,8 @@ class ComicPress { 'archive_dimensions' => '125x', 'mini_dimensions' => '100x', 'category_order' => false, - 'blogpost_count' => 10 + 'blogpost_count' => 10, + 'comic_space' => 'comic_only' ); var $additional_stylesheets = array(); diff --git a/functions.php b/functions.php index eb9e141..9589729 100644 --- a/functions.php +++ b/functions.php @@ -50,6 +50,18 @@ function __comicpress_init() { } } +function include_partial($partials = '') { + if (!is_array($partials)) { + $partials = func_get_args(); + } + + foreach ($partials as $partial) { + if (($result = include(get_template_directory() . '/partials/' . $partial . '.inc')) === true) { + return; + } + } +} + function in_comic_category() { global $post, $comicpress; diff --git a/index.php b/index.php index c1f1860..d496c24 100644 --- a/index.php +++ b/index.php @@ -7,16 +7,12 @@ $post = $nav_comics['last']; ?> - -
-
-
- +
- + comicpress_options['comic_space'] == "comic_only")) { include_partial('index-comic-post'); } ?> -
+ have_posts()) { $wp_query->the_post(); - include(get_template_directory() . '/partials/index-blog-post.inc'); + include_partial('index-blog-post'); } - include(get_template_directory() . '/partials/index-blog-post.inc'); + include_partial('index-blog-post'); ?>
diff --git a/partials/index-blog-header.inc b/partials/index-blog-header.inc new file mode 100644 index 0000000..de8b675 --- /dev/null +++ b/partials/index-blog-header.inc @@ -0,0 +1 @@ +
diff --git a/partials/index-display-comic.inc b/partials/index-display-comic.inc new file mode 100644 index 0000000..370fae4 --- /dev/null +++ b/partials/index-display-comic.inc @@ -0,0 +1,3 @@ +
+
+
diff --git a/partials/single-display-comic.inc b/partials/single-display-comic.inc new file mode 100644 index 0000000..14bb974 --- /dev/null +++ b/partials/single-display-comic.inc @@ -0,0 +1,3 @@ +
+
+
diff --git a/search.php b/search.php index 59e750f..be0a4e2 100644 --- a/search.php +++ b/search.php @@ -2,7 +2,7 @@
diff --git a/single.php b/single.php index d4b9f34..5005946 100644 --- a/single.php +++ b/single.php @@ -5,11 +5,7 @@ if (have_posts()) { the_post(); - if (in_comic_category()) { ?> -
-
-
- 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'); } diff --git a/subthemes/guild-of-thieves/index-blog-header.inc b/subthemes/guild-of-thieves/index-blog-header.inc new file mode 100644 index 0000000..29bc160 --- /dev/null +++ b/subthemes/guild-of-thieves/index-blog-header.inc @@ -0,0 +1 @@ +this is my override blog header! \ No newline at end of file