add comic space insertion type
This commit is contained in:
parent
baed6838a6
commit
82b01186ee
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,17 @@
|
|||
<p><em>(categories can be modified on the Posts -> Categories page)</em></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Insert into comic space:</th>
|
||||
<td>
|
||||
<?php foreach (array(
|
||||
"comic_only" => __("The comic only, with post content below", 'comicpress'),
|
||||
"post_content" => __("The post content", 'comicpress')
|
||||
) as $value => $label) { ?>
|
||||
<label><input type="radio" name="cp[comic_space]" value="<?php echo $value ?>" <?php echo ($this->comicpress->comicpress_options['comic_space'] == $value) ? 'checked="checked"' : "" ?> /> <?php echo $label ?></label><br />
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type="submit" value="<?php _e("Submit Changes", 'comicpress') ?>" /></td>
|
||||
|
|
10
archive.php
10
archive.php
|
@ -2,7 +2,7 @@
|
|||
|
||||
<div id="content" class="archive">
|
||||
<?php if (have_posts()) {
|
||||
include(get_template_directory() . '/partials/archive-header.inc');
|
||||
include_partial('archive-header');
|
||||
|
||||
// why can't wordpress allow for post date asc sorting out of the box...
|
||||
|
||||
|
@ -11,15 +11,15 @@
|
|||
the_post();
|
||||
|
||||
if (in_comic_category()) {
|
||||
include(get_template_directory() . '/partials/archive-comic-post.inc');
|
||||
include_partial('archive-comic-post');
|
||||
} else {
|
||||
include(get_template_directory() . '/partials/archive-blog-post.inc');
|
||||
include_partial('archive-blog-post');
|
||||
}
|
||||
}
|
||||
|
||||
include(get_template_directory() . '/partials/archive-page-nav.inc');
|
||||
include_partial('archive-page-nav');
|
||||
} else {
|
||||
include(get_template_directory() . '/partials/archive-not-found.inc');
|
||||
include_partial('archive-not-found');
|
||||
} ?>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
14
index.php
14
index.php
|
@ -7,16 +7,12 @@
|
|||
$post = $nav_comics['last'];
|
||||
?>
|
||||
|
||||
<?php if (!is_paged()) { ?>
|
||||
<div id="comic-head"></div>
|
||||
<div id="comic"><?php do_action('show_comic', null); ?></div>
|
||||
<div id="comic-foot"></div>
|
||||
<?php } ?>
|
||||
<?php if (!is_paged()) { include_partial('index-display-comic'); } ?>
|
||||
|
||||
<div id="content" class="narrowcolumn">
|
||||
<?php if (!is_paged()) { include(get_template_directory() . '/partials/index-comic-post.inc'); } ?>
|
||||
<?php if (!is_paged() && ($comicpress->comicpress_options['comic_space'] == "comic_only")) { include_partial('index-comic-post'); } ?>
|
||||
|
||||
<div id="blogheader"><!-- This area can be used for a heading above your main page blog posts --></div>
|
||||
<?php include_partial('index-blog-header'); ?>
|
||||
|
||||
<?php
|
||||
$wp_query = new WP_Query();
|
||||
|
@ -31,10 +27,10 @@
|
|||
|
||||
while ($wp_query->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');
|
||||
?>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<div id="blogheader"></div>
|
|
@ -0,0 +1,3 @@
|
|||
<div id="comic-head"></div>
|
||||
<div id="comic"><?php do_action('show_comic', null); ?></div>
|
||||
<div id="comic-foot"></div>
|
|
@ -0,0 +1,3 @@
|
|||
<div id="comic-head"></div>
|
||||
<div id="comic"><?php do_action('show_comic'); ?></div>
|
||||
<div id="comic-foot"></div>
|
10
search.php
10
search.php
|
@ -2,7 +2,7 @@
|
|||
|
||||
<div id="content" class="archive">
|
||||
<?php
|
||||
include(get_template_directory() . '/partials/search-results-count.inc');
|
||||
include_partial('search-results-count');
|
||||
|
||||
if (have_posts()) {
|
||||
query_posts($query_string . '&order=asc');
|
||||
|
@ -11,15 +11,15 @@
|
|||
the_post();
|
||||
|
||||
if (in_comic_category()) {
|
||||
include(get_template_directory() . '/partials/archive-comic-post.inc');
|
||||
include_partial('search-comic-post', 'archive-comic-post');
|
||||
} else {
|
||||
include(get_template_directory() . '/partials/archive-blog-post.inc');
|
||||
include_partial('search-blog-post', 'archive-blog-post');
|
||||
}
|
||||
}
|
||||
|
||||
include(get_template_directory() . '/partials/archive-page-nav.inc');
|
||||
include_partial('search-page-nav', 'archive-page-nav');
|
||||
} else {
|
||||
include(get_template_directory() . '/partials/search-not-found.inc');
|
||||
include_partial('search-not-found');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
|
10
single.php
10
single.php
|
@ -5,11 +5,7 @@
|
|||
|
||||
if (have_posts()) {
|
||||
the_post();
|
||||
if (in_comic_category()) { ?>
|
||||
<div id="comic-head"></div>
|
||||
<div id="comic"><?php do_action('show_comic'); ?></div>
|
||||
<div id="comic-foot"></div>
|
||||
<?php }
|
||||
if (in_comic_category()) { include_partial('single-display-comic') }
|
||||
}
|
||||
rewind_posts();
|
||||
|
||||
|
@ -21,7 +17,9 @@
|
|||
if (have_posts()) {
|
||||
while (have_posts()) { the_post();
|
||||
if (in_comic_category()) {
|
||||
include(get_template_directory() . '/partials/single-comic-post.inc');
|
||||
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');
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
this is my override blog header!
|
Loading…
Reference in New Issue