finish up some layout stuff

This commit is contained in:
John Bintz 2009-07-23 18:25:02 -04:00
parent fbec175cb8
commit aeb0adcaaf
6 changed files with 27 additions and 18 deletions

View File

@ -413,8 +413,9 @@ class ComicPressAddonCore extends ComicPressAddon {
break; break;
case 'comic_space': case 'comic_space':
case 'category_page_usage': case 'category_page_usage':
case 'layout';
$this->comicpress->comicpress_options[$option] = $_POST['cp'][$option]; $this->comicpress->comicpress_options[$option] = $_POST['cp'][$option];
break; break;
} }
} }
} }
@ -443,10 +444,13 @@ class ComicPressAddonCore extends ComicPressAddon {
} }
} }
/**
* Create the dropdown for choosing a layout.
*/
function create_layout_options($layouts, $current_layout) { function create_layout_options($layouts, $current_layout) {
$output = array(); $output = array();
foreach ($layouts as $layout_filename => $name) { foreach ($layouts as $layout_filename => $info) {
$output[] = '<option value="' . $layout_filename . '"' . (($layout_filename == $current_layout) ? ' selected="selected"' : '') . '>' . $name . '</option>'; $output[] = '<option value="' . $layout_filename . '"' . (($layout_filename == $current_layout) ? ' selected="selected"' : '') . '>' . $info['Layout Name'] . '</option>';
} }
return implode("\n", $output); return implode("\n", $output);
} }

View File

@ -48,6 +48,16 @@ function __comicpress_init() {
} }
} }
} }
$layouts = $comicpress->get_layout_choices();
if (isset($layouts[$comicpress->comicpress_options['layout']])) {
if (isset($layouts[$comicpress->comicpress_options['layout']]['Sidebars'])) {
foreach (explode(",", $layouts[$comicpress->comicpress_options['layout']]['Sidebars']) as $sidebar) {
$sidebar = trim($sidebar);
register_sidebar($sidebar);
}
}
}
} }
function comicpress_init() { function comicpress_init() {
@ -77,7 +87,7 @@ function comicpress_get_header() {
} }
function include_partial($partials = '') { function include_partial($partials = '') {
global $comicpress; global $comicpress, $post, $nav_comics;
if (!is_array($partials)) { if (!is_array($partials)) {
$partials = func_get_args(); $partials = func_get_args();

View File

@ -1,14 +1,15 @@
<?php <?php
global $comicpress; global $comicpress, $post, $nav_comics;
comicpress_init(); comicpress_init();
$nav_comics = $comicpress->get_nav_comics(); $nav_comics = $comicpress->get_nav_comics();
$t = $post; $t = $post;
$post = $nav_comics['last']; $post = $nav_comics['last'];
setup_postdata($post);
ob_start(); ob_start();
if (!is_paged()) { include_partial('index-display-comic'); } if (!is_paged()) { include_partial('index-display-comic'); }
$comic = ob_get_clean(); $comic = ob_get_clean();
@ -20,11 +21,12 @@
include_partial('index-blog-header'); include_partial('index-blog-header');
foreach ($comicpress->get_index_blog_posts() as $post) { foreach ($comicpress->get_index_blog_posts() as $post) {
setup_postdata($post);
include_partial('index-blog-post'); include_partial('index-blog-post');
} }
$content = ob_get_clean(); $content = ob_get_clean();
$post = $t; $post = $t;
include(get_template_directory() . '/layouts/classic.inc'); include(get_template_directory() . '/layouts/' . $comicpress->comicpress_options['layout']);
?> ?>

View File

@ -1,12 +1,9 @@
<?php <?php
/* /*
Layout Name: Classic Layout Name: Classic
Sidebars: right
*/ */
if (function_exists('register_sidebar')) {
register_sidebar('right');
}
?> ?>
<?php get_header() ?> <?php get_header() ?>

View File

@ -1,13 +1,9 @@
<?php <?php
/* /*
Layout Name: Classic Layout Name: Three Column
Sidebars: left,right
*/ */
if (function_exists('register_sidebar')) {
register_sidebar('left');
register_sidebar('right');
}
?> ?>
<?php get_header() ?> <?php get_header() ?>

View File

@ -2,7 +2,7 @@
<div class="post-comic"> <div class="post-comic">
<?php include('nav.inc') ?> <?php include('nav.inc') ?>
<div class="comicdate"> <div class="comicdate">
<?php the_date('F jS, Y') ?> <?php echo mysql2date('F jS, Y', $post->post_date) ?>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
<?php if (get_option('comicpress-enable-storyline-support') == 1) { ?> <?php if (get_option('comicpress-enable-storyline-support') == 1) { ?>