diff --git a/addons/Core/Core.inc b/addons/Core/Core.inc index cb6713c..f7b84cd 100644 --- a/addons/Core/Core.inc +++ b/addons/Core/Core.inc @@ -413,8 +413,9 @@ class ComicPressAddonCore extends ComicPressAddon { break; case 'comic_space': case 'category_page_usage': + case 'layout'; $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) { $output = array(); - foreach ($layouts as $layout_filename => $name) { - $output[] = ''; + foreach ($layouts as $layout_filename => $info) { + $output[] = ''; } return implode("\n", $output); } diff --git a/functions.php b/functions.php index 16b1c6f..1ad7611 100644 --- a/functions.php +++ b/functions.php @@ -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() { @@ -77,7 +87,7 @@ function comicpress_get_header() { } function include_partial($partials = '') { - global $comicpress; + global $comicpress, $post, $nav_comics; if (!is_array($partials)) { $partials = func_get_args(); diff --git a/index.php b/index.php index 2492cbb..98cb842 100644 --- a/index.php +++ b/index.php @@ -1,14 +1,15 @@ get_nav_comics(); $t = $post; $post = $nav_comics['last']; + setup_postdata($post); ob_start(); - + if (!is_paged()) { include_partial('index-display-comic'); } $comic = ob_get_clean(); @@ -20,11 +21,12 @@ include_partial('index-blog-header'); foreach ($comicpress->get_index_blog_posts() as $post) { + setup_postdata($post); include_partial('index-blog-post'); } $content = ob_get_clean(); $post = $t; - include(get_template_directory() . '/layouts/classic.inc'); + include(get_template_directory() . '/layouts/' . $comicpress->comicpress_options['layout']); ?> \ No newline at end of file diff --git a/layouts/classic.inc b/layouts/classic.inc index e9d37f3..dd6a7e8 100644 --- a/layouts/classic.inc +++ b/layouts/classic.inc @@ -1,12 +1,9 @@ diff --git a/layouts/three-column.inc b/layouts/three-column.inc index 0ddf3b7..85dd6c5 100644 --- a/layouts/three-column.inc +++ b/layouts/three-column.inc @@ -1,13 +1,9 @@ diff --git a/partials/index-comic-post.inc b/partials/index-comic-post.inc index 71625cf..7aaffc7 100644 --- a/partials/index-comic-post.inc +++ b/partials/index-comic-post.inc @@ -2,7 +2,7 @@