factor out dual author columns

This commit is contained in:
John Bintz 2009-11-20 00:02:23 -05:00
parent e43f4f5458
commit 3b81ca9ae9
5 changed files with 38 additions and 57 deletions

View File

@ -21,33 +21,9 @@ Template Name: Blog
}
comicpress_pagination();
} else { ?>
<div id="dualcolumns">
<div class="column_one">
<div class="column_one_header"></div>
<?php $blog_query = 'showposts='.$blog_postcount.'&cat="-'.exclude_comic_categories().'"&author='.$author_column_one.'&paged='.$paged;
$posts = query_posts($blog_query);
if (have_posts()) {
while (have_posts()) : the_post();
display_blog_post();
endwhile;
} else {
include('partials/dual-columns.inc');
} ?>
<span class="viewpostsbyone">View all posts by: <?php the_author_posts_link(); ?><span><br />
</div>
<div class="column_two">
<div class="column_two_header"></div>
<?php $blog_query = 'showposts='.$blog_postcount.'&cat="-'.exclude_comic_categories().'"&author='.$author_column_two;
$posts = query_posts($blog_query);
if (have_posts()) {
while (have_posts()) : the_post();
display_blog_post();
endwhile;
} ?>
<span class="viewpostsbytwo">View all posts by: <?php the_author_posts_link(); ?></span><br />
</div>
<div class="clear"></div>
</div>
<?php } ?>
<?php get_sidebar('underblog'); ?>
<?php include(get_template_directory() . '/layout-foot.php'); ?>

View File

@ -91,33 +91,9 @@ if ($disable_comic_frontpage != 'yes' && $disable_comic_blog_frontpage != 'yes'
<div class="blogindex-foot"></div>
<?php }
comicpress_pagination();
} else { ?>
<div id="dualcolumns">
<div class="column_one">
<div class="column_one_header"></div>
<?php $blog_query = 'showposts='.$blog_postcount.'&cat="-'.exclude_comic_categories().'"&author='.$author_column_one.'&paged='.$paged;
$posts = query_posts($blog_query);
if (have_posts()) {
while (have_posts()) : the_post();
display_blog_post();
endwhile;
} ?>
<span class="viewpostsbyone">View all posts by: <?php the_author_posts_link(); ?><span><br />
</div>
<div class="column_two">
<div class="column_two_header"></div>
<?php $blog_query = 'showposts='.$blog_postcount.'&cat="-'.exclude_comic_categories().'"&author='.$author_column_two;
$posts = query_posts($blog_query);
if (have_posts()) {
while (have_posts()) : the_post();
display_blog_post();
endwhile;
} ?>
<span class="viewpostsbytwo">View all posts by: <?php the_author_posts_link(); ?></span><br />
</div>
<div class="clear"></div>
</div>
<?php }
} else {
include('partials/dual-columns.inc');
}
} ?>
<?php get_sidebar('underblog'); ?>

25
partials/dual-columns.inc Normal file
View File

@ -0,0 +1,25 @@
<div id="dualcolumns">
<div class="column_one">
<div class="column_one_header"></div>
<?php $blog_query = 'showposts='.$blog_postcount.'&cat="-'.exclude_comic_categories().'"&author='.$author_column_one.'&paged='.$paged;
$posts = query_posts($blog_query);
if (have_posts()) {
while (have_posts()) : the_post();
display_blog_post();
endwhile;
} ?>
<span class="viewpostsbyone">View all posts by: <?php the_author_posts_link(); ?><span><br />
</div>
<div class="column_two">
<div class="column_two_header"></div>
<?php $blog_query = 'showposts='.$blog_postcount.'&cat="-'.exclude_comic_categories().'"&author='.$author_column_two;
$posts = query_posts($blog_query);
if (have_posts()) {
while (have_posts()) : the_post();
display_blog_post();
endwhile;
} ?>
<span class="viewpostsbytwo">View all posts by: <?php the_author_posts_link(); ?></span><br />
</div>
<div class="clear"></div>
</div>

View File

@ -79,11 +79,11 @@ class GraphicalNavigationTest extends PHPUnit_Framework_TestCase {
* @covers WidgetComicPressGraphicalStorylineNavigation::_group_navigation_buttons
*/
function testGroupNavigationButtons($buttons, $expected_grouping) {
_set_filter_expectation('comicpress_navigation_grouping_details', array(
_set_filter_expectation('comicpress_navigation_grouping_details', array(array(
'left' => array('one', 'two', 'three'),
'center' => true,
'right' => array('four', 'five', 'six'),
));
)));
$this->assertEquals($expected_grouping, $this->w->_group_navigation_buttons($buttons, array()));
}

View File

@ -179,13 +179,17 @@ class WidgetComicPressGraphicalStorylineNavigation extends WP_Widget {
$grouping_hash = array();
$default_group = null;
var_dump(apply_filters('comicpress_navigation_grouping_details', array()));
foreach (apply_filters('comicpress_navigation_grouping_details', array()) as $group => $members) {
var_dump($members);
if ($members === true) {
$default_group = $group;
} else {
if (is_array($members)) {
foreach ($members as $member) { $grouping_hash[$member] = $group; }
}
}
}
if (is_null($default_group)) {
trigger_error('No default group defined for filter comicpress_navigation_grouping_details', E_USER_WARNING);