Make WordPress Core

Ticket #19012: post-template.diff

File post-template.diff, 993 bytes (added by peterchester, 12 years ago)

Updated post template diff with (int) cast instead of is_numeric

  • wp-includes/post-template.php

     
    1111/**
    1212 * Display the ID of the current item in the WordPress Loop.
    1313 *
     14 * If the optional $id param is passed then this will simply display the $id.
     15 *
    1416 * @since 0.71
     17 *
     18 * @param int $id Optional. Post ID.
    1519 */
    16 function the_ID() {
    17         echo get_the_ID();
     20function the_ID( $id = 0 ) {
     21        echo get_the_ID( $id );
    1822}
    1923
    2024/**
    2125 * Retrieve the ID of the current item in the WordPress Loop.
    2226 *
     27 * If the optional $id param is passed then this will simply return the $id.
     28 *
    2329 * @since 2.1.0
    2430 * @uses $post
    2531 *
     32 * @param int $id Optional. Post ID.
    2633 * @return int
    2734 */
    28 function get_the_ID() {
    29         global $post;
    30         return $post->ID;
     35function get_the_ID( $id = 0 ) {
     36        if ( (int) $id > 0 ) {
     37                return $id;
     38        } else {
     39                global $post;
     40                return $post->ID;
     41        }
    3142}
    3243
    3344/**