diff --git a/index.php b/index.php index 037f13bb5c0b..b71cc4b932bc 100644 --- a/index.php +++ b/index.php @@ -59,6 +59,8 @@

+ + diff --git a/wp-admin/install.php b/wp-admin/install.php index b30c12cdd63f..a8577567cc7c 100644 --- a/wp-admin/install.php +++ b/wp-admin/install.php @@ -457,7 +457,7 @@ "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(46,'use_phoneemail', 2, '0', 'some mobile phone email services will send identical subject & content on the same line if you use such a service, set use_phoneemail to true, and indicate a separator string', 8, 20)", // original options from options page "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(48,'posts_per_page', 1, '20','How many posts/days to show on the index page.', 4, 20)", -"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(49,'what_to_show', 5, 'posts','Posts, days, or posts paged', 4, 20)", +"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(49,'what_to_show', 5, 'posts','Posts or days', 4, 20)", "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(50,'archive_mode', 5, 'monthly','Which \'unit\' to use for archives.', 4, 20)", "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(51,'time_difference', 6, '0', 'if you\'re not on the timezone of your server', 4, 20)", "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(52,'date_format', 3, 'n/j/Y', 'see note for format characters', 4, 20)", @@ -532,7 +532,6 @@ // select data for what to show "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'days', 'days', null,null,1)", "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'posts', 'posts', null,null,2)", -"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'paged', 'posts paged', null,null,3)", // select data for archive mode "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'daily', 'daily', null,null,1)", "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'weekly', 'weekly', null,null,2)", diff --git a/wp-admin/options-reading.php b/wp-admin/options-reading.php index 2bf5f65603b9..5cf5418fbdd2 100644 --- a/wp-admin/options-reading.php +++ b/wp-admin/options-reading.php @@ -56,7 +56,6 @@ function add_magic_quotes($array) { diff --git a/wp-admin/upgrade-functions.php b/wp-admin/upgrade-functions.php index d8e057b7d163..6cf619a9d01c 100644 --- a/wp-admin/upgrade-functions.php +++ b/wp-admin/upgrade-functions.php @@ -255,7 +255,7 @@ function upgrade_072() { // original options from options page "48" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (48,'posts_per_page', 1, '20','How many posts/days to show on the index page.', 4, 20)", - "49" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (49,'what_to_show', 5, 'posts','Posts, days, or posts paged', 4, 20)", + "49" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (49,'what_to_show', 5, 'posts','Posts or days', 4, 20)", "50" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (50,'archive_mode', 5, 'monthly','Which \'unit\' to use for archives.', 4, 20)", "51" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (51,'time_difference', 6, '0', 'if you\'re not on the timezone of your server', 4, 20)", "52" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (52,'date_format', 3, 'n/j/Y', 'see note for format characters', 4, 20)", @@ -422,7 +422,6 @@ function upgrade_072() { // select data for what to show "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'days', 'days', null,null,1)", "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'posts', 'posts', null,null,2)", - "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'paged', 'posts paged', null,null,3)", // select data for archive mode "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'daily', 'daily', null,null,1)", "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'weekly', 'weekly', null,null,2)", @@ -920,6 +919,10 @@ function upgrade_130() { } } + // The "paged" option for what_to_show is no more. + if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') { + $wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'"); + } } ?> \ No newline at end of file diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 02214ea5a1dc..268233180a1a 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1669,7 +1669,7 @@ function query_posts($query) { } if ( !empty($postend) && ($postend > $poststart) && (!$m) && empty($monthnum) && empty($year) && empty($day) &&(!$w) && (!$whichcat) && (!$s) && (!$p)) { - if ($what_to_show == 'posts' || ($what_to_show == 'paged' && (!$paged))) { + if ($what_to_show == 'posts') { $poststart = intval($poststart); $postend = intval($postend); $limposts = $postend - $poststart; @@ -1686,7 +1686,7 @@ function query_posts($query) { $where .= " AND post_date > '$otherdate' AND post_date < '$startdate'"; } } else { - if (($what_to_show == 'paged') && (!$p) && (!$more)) { + if (($what_to_show == 'posts') && (! is_single()) && (!$more)) { if ($pagenow != 'post.php') { $pgstrt = ''; if ($paged) { diff --git a/wp-includes/template-functions-links.php b/wp-includes/template-functions-links.php index 865f02155ba3..c9c11a66726c 100644 --- a/wp-includes/template-functions-links.php +++ b/wp-includes/template-functions-links.php @@ -348,10 +348,10 @@ function get_pagenum_link($pagenum = 1){ } function next_posts($max_page = 0) { // original by cfactor at cooltux.org - global $p, $paged, $what_to_show, $pagenow; + global $paged, $pagenow; global $querystring_start, $querystring_equal, $querystring_separator; - if (empty($p) && ($what_to_show == 'paged')) { + if (! is_single()) { if (!$paged) $paged = 1; $nextpage = intval($paged) + 1; if (!$max_page || $max_page >= $nextpage) { @@ -361,36 +361,34 @@ function next_posts($max_page = 0) { // original by cfactor at cooltux.org } function next_posts_link($label='Next Page »', $max_page=0) { - global $p, $paged, $result, $request, $posts_per_page, $what_to_show, $wpdb; - if ($what_to_show == 'paged') { - if (!$max_page) { - $nxt_request = $request; - //if the query includes a limit clause, call it again without that - //limit clause! - if ($pos = strpos(strtoupper($request), 'LIMIT')) { - $nxt_request = substr($request, 0, $pos); - } - $nxt_result = $wpdb->query($nxt_request); - $numposts = $wpdb->num_rows; - $max_page = ceil($numposts / $posts_per_page); - } - if (!$paged) - $paged = 1; - $nextpage = intval($paged) + 1; - if (empty($p) && (empty($paged) || $nextpage <= $max_page)) { - echo ''. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .''; + global $paged, $result, $request, $posts_per_page, $wpdb; + if (!$max_page) { + $nxt_request = $request; + //if the query includes a limit clause, call it again without that + //limit clause! + if ($pos = strpos(strtoupper($request), 'LIMIT')) { + $nxt_request = substr($request, 0, $pos); } + $nxt_result = $wpdb->query($nxt_request); + $numposts = $wpdb->num_rows; + $max_page = ceil($numposts / $posts_per_page); + } + if (!$paged) + $paged = 1; + $nextpage = intval($paged) + 1; + if ((! is_single()) && (empty($paged) || $nextpage <= $max_page)) { + echo ''. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .''; } } function previous_posts() { // original by cfactor at cooltux.org - global $_SERVER, $p, $paged, $what_to_show, $pagenow; + global $_SERVER, $paged, $pagenow; global $querystring_start, $querystring_equal, $querystring_separator; - if (empty($p) && ($what_to_show == 'paged')) { + if (! is_single()) { $nextpage = intval($paged) - 1; if ($nextpage < 1) $nextpage = 1; echo get_pagenum_link($nextpage); @@ -398,8 +396,8 @@ function previous_posts() { // original by cfactor at cooltux.org } function previous_posts_link($label='« Previous Page') { - global $p, $paged, $what_to_show; - if (empty($p) && ($paged > 1) && ($what_to_show == 'paged')) { + global $paged; + if ((! is_single()) && ($paged > 1) ) { echo ''. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .''; @@ -407,8 +405,8 @@ function previous_posts_link($label='« Previous Page') { } function posts_nav_link($sep=' — ', $prelabel='« Previous Page', $nxtlabel='Next Page »') { - global $p, $what_to_show, $request, $posts_per_page, $wpdb; - if (empty($p) && ($what_to_show == 'paged')) { + global $request, $posts_per_page, $wpdb; + if (! is_single()) { $nxt_request = $request; if ($pos = strpos(strtoupper($request), 'LIMIT')) { $nxt_request = substr($request, 0, $pos);