Changeset 9632
- Timestamp:
- 11/12/2008 10:13:50 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/link-template.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r9415 r9632 1055 1055 1056 1056 /** 1057 * Display the next posts pages link.1057 * Display or return the next posts pages link. 1058 1058 * 1059 1059 * @since 0.71 1060 1060 * 1061 1061 * @param int $max_page Optional. Max pages. 1062 */ 1063 function next_posts($max_page = 0) { 1064 echo clean_url(get_next_posts_page_link($max_page)); 1065 } 1066 1067 /** 1068 * Display the next posts pages link. 1069 * 1070 * @since 0.71 1062 * @param boolean $echo Optional. Echo or return; 1063 */ 1064 function next_posts( $max_page = 0, $echo = true ) { 1065 $output = clean_url( get_next_posts_page_link( $max_page ) ); 1066 1067 if ( $echo ) 1068 echo $output; 1069 else 1070 return $output; 1071 } 1072 1073 /** 1074 * Return the next posts pages link. 1075 * 1076 * @since 2.7.0 1071 1077 * 1072 1078 * @param string $label Content for link text. 1073 1079 * @param int $max_page Optional. Max pages. 1074 */ 1075 function next_posts_link($label='Next Page »', $max_page=0) { 1080 * @return string|null 1081 */ 1082 function get_next_posts_link( $label = 'Next Page »', $max_page = 0 ) { 1076 1083 global $paged, $wp_query; 1084 1077 1085 if ( !$max_page ) { 1078 1086 $max_page = $wp_query->max_num_pages; 1079 1087 } 1088 1080 1089 if ( !$paged ) 1081 1090 $paged = 1; 1091 1082 1092 $nextpage = intval($paged) + 1; 1083 if ( (! is_single()) && (empty($paged) || $nextpage <= $max_page) ) { 1084 echo '<a href="'; 1085 next_posts($max_page); 1093 1094 if ( !is_single() && ( empty($paged) || $nextpage <= $max_page) ) { 1086 1095 $attr = apply_filters( 'next_posts_link_attributes', '' ); 1087 echo "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>'; 1088 } 1096 return '<a href="' . next_posts( $max_page, false ) . "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>'; 1097 } 1098 } 1099 1100 /** 1101 * Display the next posts pages link. 1102 * 1103 * @since 0.71 1104 * @uses get_next_posts_link() 1105 * 1106 * @param string $label Content for link text. 1107 * @param int $max_page Optional. Max pages. 1108 */ 1109 function next_posts_link( $label = 'Next Page »', $max_page = 0 ) { 1110 echo get_next_posts_link( $label, $max_page ); 1089 1111 } 1090 1112 … … 1112 1134 1113 1135 /** 1114 * Display previous posts pages link.1136 * Display or return the previous posts pages link. 1115 1137 * 1116 1138 * @since 0.71 1117 */ 1118 function previous_posts() { 1119 echo clean_url(get_previous_posts_page_link()); 1120 } 1121 1122 /** 1123 * Display previous posts page link. 1139 * 1140 * @param boolean $echo Optional. Echo or return; 1141 */ 1142 function previous_posts( $echo = true ) { 1143 $output = clean_url( get_previous_posts_page_link() ); 1144 1145 if ( $echo ) 1146 echo $output; 1147 else 1148 return $output; 1149 } 1150 1151 /** 1152 * Return the previous posts pages link. 1153 * 1154 * @since 2.7.0 1155 * 1156 * @param string $label Optional. Previous page link text. 1157 * @return string|null 1158 */ 1159 function get_previous_posts_link( $label = '« Previous Page' ) { 1160 global $paged; 1161 1162 if ( !is_single() && $paged > 1 ) { 1163 $attr = apply_filters( 'previous_posts_link_attributes', '' ); 1164 return '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/', '&$1', $label ) .'</a>'; 1165 } 1166 } 1167 1168 /** 1169 * Display the previous posts page link. 1124 1170 * 1125 1171 * @since 0.71 1172 * @uses get_previous_posts_link() 1126 1173 * 1127 1174 * @param string $label Optional. Previous page link text. 1128 1175 */ 1129 function previous_posts_link($label='« Previous Page') { 1130 global $paged; 1131 if ( (!is_single()) && ($paged > 1) ) { 1132 echo '<a href="'; 1133 previous_posts(); 1134 $attr = apply_filters( 'previous_posts_link_attributes', '' ); 1135 echo "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>'; 1136 } 1176 function previous_posts_link( $label = '« Previous Page' ) { 1177 echo get_previous_posts_link( $label ); 1137 1178 } 1138 1179 … … 1146 1187 * @param string $nxtlabel Optional Label for next pages. 1147 1188 */ 1148 function posts_nav_link( $sep=' — ', $prelabel='« Previous Page', $nxtlabel='Next Page »') {1189 function posts_nav_link( $sep = ' — ', $prelabel = '« Previous Page', $nxtlabel = 'Next Page »' ) { 1149 1190 global $wp_query; 1150 1191 if ( !is_singular() ) {
Note: See TracChangeset
for help on using the changeset viewer.