WordPress.org

Make WordPress Core

Ticket #7402: get_calendar.patch

File get_calendar.patch, 1.8 KB (added by docwhat, 7 years ago)
  • wp-includes/general-template.php

    diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
    index 1d07014..ef8fbcf 100644
    a b function get_calendar($initial = true) { 
    667667                $daywithpost = array(); 
    668668        } 
    669669 
     670        // Check what day this post is (if it's a single post) 
     671        if (is_single() && count($posts) == 1) { 
     672                $current_post_day = $wpdb->get_var("SELECT DAYOFMONTH(post_date) 
     673                        FROM $wpdb->posts WHERE MONTH(post_date) = '$thismonth' 
     674                        AND YEAR(post_date) = '$thisyear' 
     675                        AND post_type = 'post' AND post_status = 'publish' 
     676                        AND post_date < '" . current_time('mysql') . "' 
     677                        AND id = " . $posts[0]->ID . ";"); 
     678        } 
     679 
     680 
     681 
    670682        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'camino') !== false || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false) 
    671683                $ak_title_separator = "\n"; 
    672684        else 
    function get_calendar($initial = true) { 
    707719                        echo "\n\t</tr>\n\t<tr>\n\t\t"; 
    708720                $newrow = false; 
    709721 
    710                 if ( $day == gmdate('j', (time() + (get_option('gmt_offset') * 3600))) && $thismonth == gmdate('m', time()+(get_option('gmt_offset') * 3600)) && $thisyear == gmdate('Y', time()+(get_option('gmt_offset') * 3600)) ) 
     722                if ( $day == gmdate('j', (time() + (get_option('gmt_offset') * 3600))) && $thismonth == gmdate('m', time()+(get_option('gmt_offset') * 3600)) && $thisyear == gmdate('Y', time()+(get_option('gmt_offset') * 3600)) ) { 
    711723                        echo '<td id="today">'; 
    712                 else 
     724                } elseif ($day == $current_post_day) { 
     725                        echo '<td id="thispost">'; 
     726                } else { 
    713727                        echo '<td>'; 
     728                } 
    714729 
    715730                if ( in_array($day, $daywithpost) ) // any posts today? 
    716731                                echo '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"$ak_titles_for_day[$day]\">$day</a>";