Add $post_per_archive_page to override the number of posts to show for an archive page. Turn off paging if $post_per_* are set to -1.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-10-27 23:58:40 +00:00
parent ec579f4ec6
commit 7815372fc7
2 changed files with 11 additions and 13 deletions

View File

@ -150,21 +150,10 @@ if (is_404()) {
// Getting settings from DB
if ( isset($doing_rss) && $doing_rss == 1 )
$posts_per_page = get_settings('posts_per_rss');
if ( !isset($posts_per_page) || $posts_per_page == 0 )
$posts_per_page = get_settings('posts_per_page');
if ( !isset($what_to_show) )
$what_to_show = get_settings('what_to_show');
if ( isset($showposts) && $showposts ) {
$showposts = (int) $showposts;
$posts_per_page = $showposts;
}
if ( !isset($nopaging) ) {
$nopaging = '';
}
$use_gzipcompression = get_settings('gzipcompression');
$more_wpvars = array('posts_per_page', 'what_to_show', 'showposts', 'nopaging');
$more_wpvars = array('posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging');
// Construct the query string.
$query_string = '';

View File

@ -212,7 +212,16 @@ class WP_Query {
$q['showposts'] = (int) $q['showposts'];
$q['posts_per_page'] = $q['showposts'];
}
if ( (isset($q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && (is_archive() || is_search()) )
$q['posts_per_page'] = $q['posts_per_archive_page'];
if ( !isset($q['nopaging']) ) {
if ($q['posts_per_page'] == -1) {
$q['nopaging'] = true;
} else {
$q['nopaging'] = false;
}
}
$add_hours = intval(get_settings('gmt_offset'));
$add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));
$wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)";