Tweaks to calendar and CSS per Alex's and Dunstan's suggestions.
git-svn-id: http://svn.automattic.com/wordpress/trunk@523 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
536c539b3b
commit
df4544620c
|
@ -231,8 +231,6 @@ function get_archives($type='', $limit='', $format='html', $before = "", $after
|
||||||
function get_calendar($daylength = 1) {
|
function get_calendar($daylength = 1) {
|
||||||
global $wpdb, $HTTP_GET_VARS, $m, $monthnum, $year, $timedifference, $month, $weekday, $tableposts, $posts;
|
global $wpdb, $HTTP_GET_VARS, $m, $monthnum, $year, $timedifference, $month, $weekday, $tableposts, $posts;
|
||||||
|
|
||||||
$ak_use_tooltip_titles = 1; // set this to 1 to have the day's post titles as tooltips to the calendar date.
|
|
||||||
|
|
||||||
// Quick check. If we have no posts at all, abort!
|
// Quick check. If we have no posts at all, abort!
|
||||||
if (!$posts) {
|
if (!$posts) {
|
||||||
$gotsome = $wpdb->get_var("SELECT ID from $tableposts WHERE post_status = 'publish' AND post_category > 0 ORDER BY post_date DESC LIMIT 1");
|
$gotsome = $wpdb->get_var("SELECT ID from $tableposts WHERE post_status = 'publish' AND post_category > 0 ORDER BY post_date DESC LIMIT 1");
|
||||||
|
@ -302,17 +300,17 @@ function get_calendar($daylength = 1) {
|
||||||
get_month_link($previous->year, $previous->month) . '" title="View posts for ' . $month[zeroise($previous->month, 2)] . ' ' .
|
get_month_link($previous->year, $previous->month) . '" title="View posts for ' . $month[zeroise($previous->month, 2)] . ' ' .
|
||||||
date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year)) . '">« ' . substr($month[zeroise($previous->month, 2)], 0, 3) . '</a></td>';
|
date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year)) . '">« ' . substr($month[zeroise($previous->month, 2)], 0, 3) . '</a></td>';
|
||||||
} else {
|
} else {
|
||||||
echo "\n\t\t".'<td colspan="3" id="prev">«</td>';
|
echo "\n\t\t".'<td colspan="3" id="prev" class="pad"> </td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "\n\t\t".'<td> </td>';
|
echo "\n\t\t".'<td class="pad"> </td>';
|
||||||
|
|
||||||
if ($next) {
|
if ($next) {
|
||||||
echo "\n\t\t".'<td abbr="' . $month[zeroise($next->month, 2)] . '" colspan="3" id="next"><a href="' .
|
echo "\n\t\t".'<td abbr="' . $month[zeroise($next->month, 2)] . '" colspan="3" id="next"><a href="' .
|
||||||
get_month_link($previous->year, $next->month) . '" title="View posts for ' . $month[zeroise($next->month, 2)] . ' ' .
|
get_month_link($previous->year, $next->month) . '" title="View posts for ' . $month[zeroise($next->month, 2)] . ' ' .
|
||||||
date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year)) . '">' . substr($month[zeroise($next->month, 2)], 0, 3) . ' »</a></td>';
|
date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year)) . '">' . substr($month[zeroise($next->month, 2)], 0, 3) . ' »</a></td>';
|
||||||
} else {
|
} else {
|
||||||
echo "\n\t\t".'<td colspan="3" id="next">»</td>';
|
echo "\n\t\t".'<td colspan="3" id="next" class="pad"> </td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
|
@ -338,36 +336,36 @@ function get_calendar($daylength = 1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($ak_use_tooltip_titles == 1) {
|
|
||||||
if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE") ||
|
|
||||||
strstr(strtolower($_SERVER["HTTP_USER_AGENT"]), "camino")) {
|
|
||||||
$ak_title_separator = "\n";
|
|
||||||
} else {
|
|
||||||
$ak_title_separator = ", ";
|
|
||||||
}
|
|
||||||
|
|
||||||
$ak_titles_for_day = array();
|
if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE") ||
|
||||||
$ak_post_titles = $wpdb->get_results("SELECT post_title, DAYOFMONTH(post_date) as dom "
|
strstr(strtolower($_SERVER["HTTP_USER_AGENT"]), "camino")) {
|
||||||
."FROM $tableposts "
|
$ak_title_separator = "\n";
|
||||||
."WHERE YEAR(post_date) = '$thisyear' "
|
} else {
|
||||||
."AND MONTH(post_date) = '$thismonth' "
|
$ak_title_separator = ", ";
|
||||||
."AND post_date < '".date("Y-m-d H:i:s", (time() + ($time_difference * 3600)))."' "
|
}
|
||||||
."AND post_status = 'publish'"
|
|
||||||
);
|
$ak_titles_for_day = array();
|
||||||
if ($ak_post_titles) {
|
$ak_post_titles = $wpdb->get_results("SELECT post_title, DAYOFMONTH(post_date) as dom "
|
||||||
foreach ($ak_post_titles as $ak_post_title) {
|
."FROM $tableposts "
|
||||||
if (empty($ak_titles_for_day["$ak_post_title->dom"])) { // first one
|
."WHERE YEAR(post_date) = '$thisyear' "
|
||||||
$ak_titles_for_day["$ak_post_title->dom"] .= htmlspecialchars(stripslashes($ak_post_title->post_title));
|
."AND MONTH(post_date) = '$thismonth' "
|
||||||
} else {
|
."AND post_date < '".date("Y-m-d H:i:s", (time() + ($time_difference * 3600)))."' "
|
||||||
$ak_titles_for_day["$ak_post_title->dom"] .= $ak_title_separator . htmlspecialchars(stripslashes($ak_post_title->post_title));
|
."AND post_status = 'publish'"
|
||||||
}
|
);
|
||||||
|
if ($ak_post_titles) {
|
||||||
|
foreach ($ak_post_titles as $ak_post_title) {
|
||||||
|
if (empty($ak_titles_for_day["$ak_post_title->dom"])) { // first one
|
||||||
|
$ak_titles_for_day["$ak_post_title->dom"] .= htmlspecialchars(stripslashes($ak_post_title->post_title));
|
||||||
|
} else {
|
||||||
|
$ak_titles_for_day["$ak_post_title->dom"] .= $ak_title_separator . htmlspecialchars(stripslashes($ak_post_title->post_title));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// See how much we should pad in the beginning
|
// See how much we should pad in the beginning
|
||||||
$pad = intval(date('w', $unixmonth));
|
$pad = intval(date('w', $unixmonth));
|
||||||
if (0 != $pad) echo "\n\t\t<td colspan='$pad'> </td>";
|
if (0 != $pad) echo "\n\t\t<td colspan='$pad' class='pad'> </td>";
|
||||||
|
|
||||||
$daysinmonth = intval(date('t', $unixmonth));
|
$daysinmonth = intval(date('t', $unixmonth));
|
||||||
for ($day = 1; $day <= $daysinmonth; ++$day) {
|
for ($day = 1; $day <= $daysinmonth; ++$day) {
|
||||||
|
@ -381,22 +379,19 @@ function get_calendar($daylength = 1) {
|
||||||
echo "<td>";
|
echo "<td>";
|
||||||
|
|
||||||
if (in_array($day, $daywithpost)) { // any posts today?
|
if (in_array($day, $daywithpost)) { // any posts today?
|
||||||
if ($ak_use_tooltip_titles == 1) { // check to see if we want to show the tooltip titles
|
echo '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"$ak_titles_for_day[$day]\">$day</a>";
|
||||||
echo '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"$ak_titles_for_day[$day]\">$day</a>";
|
|
||||||
} else {
|
|
||||||
echo '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\">$day</a>";
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
echo $day;
|
echo $day;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
if (6 == date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear)))
|
if (6 == date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear)))
|
||||||
$newrow = true;
|
$newrow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pad = 7 - date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear));
|
$pad = 7 - date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear));
|
||||||
if (0 != $pad)
|
if (0 != $pad)
|
||||||
echo "\n\t\t<td class='empty' colspan='$pad'> </td>";
|
echo "\n\t\t<td class='pad' colspan='$pad'> </td>";
|
||||||
|
|
||||||
echo "\n\t</tr>\n\t</tbody>\n\t</table>";
|
echo "\n\t</tr>\n\t</tbody>\n\t</table>";
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,6 @@ p, li, .feedback {
|
||||||
letter-spacing: -1px;
|
letter-spacing: -1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.credit {
|
.credit {
|
||||||
background: #90a090;
|
background: #90a090;
|
||||||
border-top: double 3px #aba;
|
border-top: double 3px #aba;
|
||||||
|
@ -105,8 +104,8 @@ p, li, .feedback {
|
||||||
}
|
}
|
||||||
|
|
||||||
#commentform input, #commentform textarea {
|
#commentform input, #commentform textarea {
|
||||||
|
background: #fff;
|
||||||
border: 1px solid #333;
|
border: 1px solid #333;
|
||||||
background-color: #fff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#commentform textarea {
|
#commentform textarea {
|
||||||
|
@ -190,6 +189,7 @@ p, li, .feedback {
|
||||||
#menu ul ul li {
|
#menu ul ul li {
|
||||||
border: 0;
|
border: 0;
|
||||||
font: normal normal 70%/115% 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
|
font: normal normal 70%/115% 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
|
||||||
|
height: 14px;
|
||||||
letter-spacing: 0;
|
letter-spacing: 0;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -198,7 +198,7 @@ p, li, .feedback {
|
||||||
|
|
||||||
#menu ul ul li a {
|
#menu ul ul li a {
|
||||||
color: #000;
|
color: #000;
|
||||||
height: 13px;
|
display: block;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,9 +242,13 @@ p, li, .feedback {
|
||||||
#wp-calendar td {
|
#wp-calendar td {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
font: normal 12px 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
|
font: normal 12px 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
|
||||||
text-align: center;
|
|
||||||
padding: 2px 0;
|
|
||||||
letter-spacing: normal;
|
letter-spacing: normal;
|
||||||
|
padding: 2px 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wp-calendar td.pad:hover {
|
||||||
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
#wp-calendar td:hover, #wp-calendar #today {
|
#wp-calendar td:hover, #wp-calendar #today {
|
||||||
|
|
Loading…
Reference in New Issue