Ticket #42814: 42814.patch
File 42814.patch, 1.5 KB (added by , 6 years ago) |
---|
-
src/wp-includes/post-template.php
281 281 if ( post_password_required( $post ) ) 282 282 return get_the_password_form( $post ); 283 283 284 if ( $page > count( $pages ) ) // if the requested page doesn't exist 285 $page = count( $pages ); // give them the highest numbered page that DOES exist 284 if(is_array($pages) ) { 285 $pages_count = count( $pages ); 286 } else { 287 $pages_count = 0; 288 } 289 290 if ( $page > $pages_count ) // if the requested page doesn't exist 291 $page = $pages_count; // give them the highest numbered page that DOES exist 286 292 287 293 $content = $pages[$page - 1]; 288 294 if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) { … … 304 310 $teaser = ''; 305 311 306 312 $output .= $teaser; 313 314 if(is_array($content)) { 315 $content_count = count($content); 316 } else { 317 $content_count = 0; 318 } 307 319 308 if ( count( $content )> 1 ) {320 if ( $content_count > 1 ) { 309 321 if ( $more ) { 310 322 $output .= '<span id="more-' . $post->ID . '"></span>' . $content[1]; 311 323 } else { … … 997 1009 */ 998 1010 function post_custom( $key = '' ) { 999 1011 $custom = get_post_custom(); 1000 1012 1013 if(is_array($custom[$key])) { 1014 $custom_count = count($custom[$key]); 1015 } else { 1016 $custom_count = 0; 1017 } 1018 1001 1019 if ( !isset( $custom[$key] ) ) 1002 1020 return false; 1003 elseif ( 1 == count($custom[$key]))1021 elseif ( 1 == $custom_count ) 1004 1022 return $custom[$key][0]; 1005 1023 else 1006 1024 return $custom[$key];