[wp-cvs] wordpress/wp-includes functions.php, 1.135,
1.136 template-functions-links.php, 1.21, 1.22
Ryan Boren
rboren at users.sourceforge.net
Thu Jul 29 03:34:10 UTC 2004
Update of /cvsroot/cafelog/wordpress/wp-includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22568/wp-includes
Modified Files:
functions.php template-functions-links.php
Log Message:
Simplify post paging. Remove "posts paged" setting. We should always page. Add posts_nav_link() to the default template.
Index: template-functions-links.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/template-functions-links.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** template-functions-links.php 18 Jun 2004 00:22:09 -0000 1.21
--- template-functions-links.php 29 Jul 2004 03:34:08 -0000 1.22
***************
*** 349,356 ****
function next_posts($max_page = 0) { // original by cfactor at cooltux.org
! global $p, $paged, $what_to_show, $pagenow;
global $querystring_start, $querystring_equal, $querystring_separator;
! if (empty($p) && ($what_to_show == 'paged')) {
if (!$paged) $paged = 1;
$nextpage = intval($paged) + 1;
--- 349,356 ----
function next_posts($max_page = 0) { // original by cfactor at cooltux.org
! global $paged, $pagenow;
global $querystring_start, $querystring_equal, $querystring_separator;
! if (! is_single()) {
if (!$paged) $paged = 1;
$nextpage = intval($paged) + 1;
***************
*** 362,386 ****
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 '<a href="';
! next_posts($max_page);
! echo '">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>';
}
}
}
--- 362,384 ----
function next_posts_link($label='Next Page »', $max_page=0) {
! 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 '<a href="';
+ next_posts($max_page);
+ echo '">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>';
}
}
***************
*** 388,395 ****
function previous_posts() { // original by cfactor at cooltux.org
! global $_SERVER, $p, $paged, $what_to_show, $pagenow;
global $querystring_start, $querystring_equal, $querystring_separator;
! if (empty($p) && ($what_to_show == 'paged')) {
$nextpage = intval($paged) - 1;
if ($nextpage < 1) $nextpage = 1;
--- 386,393 ----
function previous_posts() { // original by cfactor at cooltux.org
! global $_SERVER, $paged, $pagenow;
global $querystring_start, $querystring_equal, $querystring_separator;
! if (! is_single()) {
$nextpage = intval($paged) - 1;
if ($nextpage < 1) $nextpage = 1;
***************
*** 399,404 ****
function previous_posts_link($label='« Previous Page') {
! global $p, $paged, $what_to_show;
! if (empty($p) && ($paged > 1) && ($what_to_show == 'paged')) {
echo '<a href="';
previous_posts();
--- 397,402 ----
function previous_posts_link($label='« Previous Page') {
! global $paged;
! if ((! is_single()) && ($paged > 1) ) {
echo '<a href="';
previous_posts();
***************
*** 408,413 ****
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')) {
$nxt_request = $request;
if ($pos = strpos(strtoupper($request), 'LIMIT')) {
--- 406,411 ----
function posts_nav_link($sep=' — ', $prelabel='« Previous Page', $nxtlabel='Next Page »') {
! global $request, $posts_per_page, $wpdb;
! if (! is_single()) {
$nxt_request = $request;
if ($pos = strpos(strtoupper($request), 'LIMIT')) {
Index: functions.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/functions.php,v
retrieving revision 1.135
retrieving revision 1.136
diff -C2 -d -r1.135 -r1.136
*** functions.php 28 Jul 2004 02:43:54 -0000 1.135
--- functions.php 29 Jul 2004 03:34:08 -0000 1.136
***************
*** 1670,1674 ****
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))) {
$poststart = intval($poststart);
$postend = intval($postend);
--- 1670,1674 ----
if ( !empty($postend) && ($postend > $poststart) && (!$m) && empty($monthnum) && empty($year) && empty($day) &&(!$w) && (!$whichcat) && (!$s) && (!$p)) {
! if ($what_to_show == 'posts') {
$poststart = intval($poststart);
$postend = intval($postend);
***************
*** 1687,1691 ****
}
} else {
! if (($what_to_show == 'paged') && (!$p) && (!$more)) {
if ($pagenow != 'post.php') {
$pgstrt = '';
--- 1687,1691 ----
}
} else {
! if (($what_to_show == 'posts') && (! is_single()) && (!$more)) {
if ($pagenow != 'post.php') {
$pgstrt = '';
More information about the cvs
mailing list