Ticket #2834: template-functions-links.php.diff
| File template-functions-links.php.diff, 2.7 KB (added by paulschreiber, 7 years ago) |
|---|
-
.php
old new 445 445 return $qstr; 446 446 } 447 447 448 function next_posts($max_page = 0) { // original by cfactor at cooltux.org 448 function next_posts($max_page = 0) { 449 print next_posts_text($max_page); 450 } 451 452 function next_posts_text($max_page = 0) { // original by cfactor at cooltux.org 449 453 global $paged, $pagenow; 450 454 451 455 if ( !is_single() ) { … … 453 457 $paged = 1; 454 458 $nextpage = intval($paged) + 1; 455 459 if ( !$max_page || $max_page >= $nextpage ) 456 echoget_pagenum_link($nextpage);460 return get_pagenum_link($nextpage); 457 461 } 458 462 } 459 463 460 464 function next_posts_link($label='Next Page »', $max_page=0) { 465 print next_posts_link_text($label, $max_page); 466 } 467 468 function next_posts_link_text($label='Next Page »', $max_page=0) { 461 469 global $paged, $result, $request, $posts_per_page, $wpdb, $max_num_pages; 462 470 if ( !$max_page ) { 463 471 if ( isset($max_num_pages) ) { … … 473 481 $paged = 1; 474 482 $nextpage = intval($paged) + 1; 475 483 if ( (! is_single()) && (empty($paged) || $nextpage <= $max_page) ) { 476 echo '<a href="'; 477 next_posts($max_page); 478 echo '">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>'; 484 $np_text = next_posts_text($max_page); 485 486 if ($np_text) { 487 $result = '<a href="'; 488 $result .= $np_text; 489 $result .= '">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>'; 490 return $result; 491 } 479 492 } 493 494 return false; 480 495 } 481 496 482 497 483 function previous_posts() { // original by cfactor at cooltux.org 498 function previous_posts() { 499 print previous_posts_text(); 500 } 501 502 function previous_posts_text() { // original by cfactor at cooltux.org 484 503 global $paged, $pagenow; 485 504 486 505 if ( !is_single() ) { 487 506 $nextpage = intval($paged) - 1; 488 507 if ( $nextpage < 1 ) 489 508 $nextpage = 1; 490 echoget_pagenum_link($nextpage);509 return get_pagenum_link($nextpage); 491 510 } 492 511 } 493 512 494 495 513 function previous_posts_link($label='« Previous Page') { 514 print previous_posts_link_text($label); 515 } 516 517 function previous_posts_link_text($label='« Previous Page') { 496 518 global $paged; 497 519 if ( (!is_single()) && ($paged > 1) ) { 498 echo '<a href="'; 499 previous_posts(); 500 echo '">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>'; 520 $pp_text = previous_posts_text(); 521 522 if ($pp_text) { 523 $result = '<a href="'; 524 $result .= $pp_text; 525 $result .= '">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>'; 526 return $result; 527 } 501 528 } 529 530 return false; 502 531 } 503 532 504 533 function posts_nav_link($sep=' — ', $prelabel='« Previous Page', $nxtlabel='Next Page »') {
