Make WordPress Core


Ignore:
Timestamp:
09/04/2012 04:29:28 PM (13 years ago)
Author:
ryan
Message:

Use get_post() instead of global $post.
Make the $post argument to get_post() optional, defaulting to the current post in The Loop.

Props nacin
see #21309

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r21610 r21735  
    13121312 */
    13131313function the_date_xml() {
    1314     global $post;
    1315     echo mysql2date('Y-m-d', $post->post_date, false);
     1314    echo mysql2date( 'Y-m-d', get_post()->post_date, false );
    13161315}
    13171316
     
    13681367 */
    13691368function get_the_date( $d = '' ) {
    1370     global $post;
     1369    $post = get_post();
    13711370    $the_date = '';
    13721371
     
    15291528 */
    15301529function the_weekday() {
    1531     global $wp_locale, $post;
    1532     $the_weekday = $wp_locale->get_weekday(mysql2date('w', $post->post_date, false));
     1530    global $wp_locale;
     1531    $the_weekday = $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) );
    15331532    $the_weekday = apply_filters('the_weekday', $the_weekday);
    15341533    echo $the_weekday;
     
    15471546 */
    15481547function the_weekday_date($before='',$after='') {
    1549     global $wp_locale, $post, $day, $previousweekday;
     1548    global $wp_locale, $day, $previousweekday;
    15501549    $the_weekday_date = '';
    15511550    if ( $currentday != $previousweekday ) {
    15521551        $the_weekday_date .= $before;
    1553         $the_weekday_date .= $wp_locale->get_weekday(mysql2date('w', $post->post_date, false));
     1552        $the_weekday_date .= $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) );
    15541553        $the_weekday_date .= $after;
    15551554        $previousweekday = $currentday;
Note: See TracChangeset for help on using the changeset viewer.