For right now, I duplicated Organize Series (2.2) and changed the names of variables and functions to make it "Organize Chapters", with its own Admin section to "Organize Multichapter Works".
I'm having one problem. I've got a development version on my local machine (Windows IIS7), and am testing the move up to the production version (Linux). Both use PHP Version 5.2.14.
Everything looks fine in development, but on the production server the number %total_posts_in_series% is one higher than it should be. Here's what happens when I put in tracking code:
function wp_postlist_count($ser_id = false) {
echo 'inside wp_postlist_count ';
if (!$ser_id) {
echo 'Point A ';
$series = get_the_series();
if (!empty($series)) {
echo 'Point B ';
$postlist_count = $series[0]->count;
} else {
echo 'Point C ';
$postlist_count = 0;
}
} else {
echo 'Point D ';
$series = get_orgserial($ser_id);
if (!empty($series)) {
echo 'Point E ';
$postlist_count = $series->count;
} else {
echo 'Point F ';
$postlist_count = 0;
}
}
return $postlist_count;
}
Results on development system, for a "series" with a single post in it:
inside wp_postlist_count Point A Point B inside wp_postlist_count Point A Point B inside wp_postlist_count Point A Point B
This entry is part 1 of 1 in the series
On production system:
inside wp_postlist_count Point A Point B inside wp_postlist_count Point A Point B inside wp_postlist_count Point A Point B inside wp_postlist_count Point A Point B
This entry is part 1 of 2 in the series
Clearly, on the production system the function is going through an extra loop -- but I don't know why, or how to make it stop.