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: https://develop.svn.wordpress.org/trunk@1835 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5a32ea0adc
commit
00d3226b7b
|
@ -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 = '';
|
||||
|
|
|
@ -212,6 +212,15 @@ 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));
|
||||
|
|
Loading…
Reference in New Issue