I've been trying to set up a way to write posts in a series on my site. The idea is that each post can belong to a different series in a custom taxonomy. I've gotten just about everything set up the way I want it ... with one exception.
Registering the Taxonomy
This part is working. I've dropped the following code into a plug-in:
function jdm_build_series_taxonomy() {
$labels = array(
'name' => _x('Series Labels', 'taxonomy general name'),
'singular_name' => _x('Series Label', 'taxonomy singular name'),
'search_items' => __('Search Series Labels'),
'popular_items' => __('Popular Series Labels'),
'all_items' => __('All Series Labels'),
'parent_item' => __('Parent Series Label'),
'parent_item_colon' => __('Parent Series Label:'),
'edit_item' => __('Edit Series Label'),
'update_item' => __('Update Series Label'),
'add_new_item' => __('Add New Series Label'),
'new_item_name' => __('New Series Label Name')
);
register_taxonomy(
'series',
'post',
array(
'hierarchical' => true,
'label' => __('Series'),
'labels' => $labels,
'query_var' => true,
'rewrite' => true
)
);
}
add_action( 'init', 'jdm_build_series_taxonomy', 0 );
This adds "Series Labels" to the Posts dropdown menu and gives me a "Series Labels" box on the post edit screen. Everything's working, and I can mark posts as a part of a series perfectly. The problem lies in the next section ...
Listing items in the Taxonomy
My goal is to allow readers to walk through a series one post at a time, starting with the oldest post and moving forwards chronologically. This is different than a typical archive page, because I have 10 posts per page for my archives, but I obviously want only one post per page for my series archive.
I've created a taxonomy-series.php
file inside my template. And it half works. The first page will work just fine - http://localhost/wp/series/my-test-series/
displays the first article in the series with the "Next Entry »" link on the bottom of the page. So far, so good ...
But when you click "Next Entry »" and go to the next page (http://localhost/wp/series/my-test-series/page/2/
) it's a) the wrong article and b) the wrong template!
However, if I set "Blog pages show at most:" to "1" on the Reading page (it's normally set to 10) then things work just fine. Page 2 displays the second article, page 3 displays the third, etc.
So ... what do I need to double check to force the taxonomy archive page to display only one post on each page? I've tried the following:
$new_query = wp_parse_args(
$query_string,
array(
'posts_per_page' => 1,
'paged' => $paged
)
);
query_posts($new_query);
and
query_posts($query_string.'&posts_per_page=1&paged='.$paged);
to no avail ... ideas? Tips? Suggestions?