Changeset 510
- Timestamp:
- 11/03/2003 05:22:01 PM (22 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/b2-include/b2template.functions.php
r509 r510 229 229 } 230 230 231 function get_calendar( ) {232 global $wpdb, $HTTP_GET_VARS, $m, $monthnum, $year, $timedifference, $month, $ tableposts;231 function get_calendar($daylength = 1) { 232 global $wpdb, $HTTP_GET_VARS, $m, $monthnum, $year, $timedifference, $month, $weekday, $tableposts; 233 233 // Quick check. If we have no posts at all, abort! 234 234 if (!$posts) { … … 269 269 FROM $tableposts 270 270 WHERE post_date < '$thisyear-$thismonth-01' 271 AND post_status = 'publish' 271 272 ORDER BY post_date DESC 272 273 LIMIT 1"); 273 274 $next = $wpdb->get_row("SELECT DISTINCT MONTH( post_date ) AS month, YEAR( post_date ) AS year 274 275 FROM $tableposts 275 WHERE post_date > '$thisyear-$thismonth-01' AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' ) 276 WHERE post_date > '$thisyear-$thismonth-01' 277 AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' ) 278 AND post_status = 'publish' 276 279 ORDER BY post_date ASC 277 LIMIT 1 280 LIMIT 1"); 278 281 279 282 echo '<table id="wp-calendar"> 280 283 <caption>' . $month[zeroise($thismonth, 2)] . ' ' . date('Y', $unixmonth) . '</caption> 281 284 <thead> 282 <tr> 283 <th abbr="Sunday" scope="col" title="Sunday">Sun</th> 284 <th abbr="Monday" scope="col" title="Monday">Mon</th> 285 <th abbr="Tuesday" scope="col" title="Tuesday">Tue</th> 286 <th abbr="Wednesday" scope="col" title="Wednesday">Wed</th> 287 <th abbr="Thursday" scope="col" title="Thursday">Thu</th> 288 <th abbr="Friday" scope="col" title="Friday">Fri</th> 289 <th abbr="Saturday" scope="col" title="Saturday">Sat</th> 290 </tr> 285 <tr>'; 286 foreach ($weekday as $wd) { 287 echo "\n\t<th abbr='$wd' scope='col' title='$wd'>" . substr($wd, 0, $daylength) . '</th>'; 288 } 289 290 echo ' </tr> 291 291 </thead> 292 292 … … 295 295 296 296 if ($previous) { 297 echo '<thabbr="' . $month[zeroise($previous->month, 2)] . '" colspan="3" id="prev"><a href="' .297 echo "\n\t".'<td abbr="' . $month[zeroise($previous->month, 2)] . '" colspan="3" id="prev"><a href="' . 298 298 get_month_link($previous->year, $previous->month) . '" title="View posts for ' . $month[zeroise($previous->month, 2)] . ' ' . 299 date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year)) . '">« ' . substr($month[zeroise($previous->month, 2)], 0, 3) . '</a> ';299 date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year)) . '">« ' . substr($month[zeroise($previous->month, 2)], 0, 3) . '</a></td>'; 300 300 } else { 301 echo '<th colspan="3" id="prev">«</th>';302 } 303 304 echo '<th> </th>';301 echo "\n\t".'<td colspan="3" id="prev">«</td>'; 302 } 303 304 echo "\n\t".'<td> </td>'; 305 305 306 306 if ($next) { 307 echo '<thabbr="' . $month[zeroise($next->month, 2)] . '" colspan="3" id="next"><a href="' .307 echo "\n\t".'<td abbr="' . $month[zeroise($next->month, 2)] . '" colspan="3" id="next"><a href="' . 308 308 get_month_link($previous->year, $next->month) . '" title="View posts for ' . $month[zeroise($next->month, 2)] . ' ' . 309 date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year)) . '">' . substr($month[zeroise($next->month, 2)], 0, 3) . ' »</a> ';309 date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year)) . '">' . substr($month[zeroise($next->month, 2)], 0, 3) . ' »</a></td>'; 310 310 } else { 311 echo '<th colspan="3" id="next">»</th>'; 312 } 313 314 echo ' </tr> 311 echo "\n\t".'<td colspan="3" id="next">»</td>'; 312 } 313 314 echo ' 315 </tr> 315 316 </tfoot> 316 317 … … 324 325 AND post_status = 'publish' 325 326 AND post_date < '" . date("Y-m-d H:i:s", (time() + ($time_difference * 3600)))."'", ARRAY_N); 326 foreach ($dayswithposts as $daywith) { 327 $daywithpost[] = $daywith[0]; 327 328 if ($dayswithposts) { 329 foreach ($dayswithposts as $daywith) { 330 $daywithpost[] = $daywith[0]; 331 } 332 } else { 333 $daywithpost = array(); 328 334 } 329 335 330 336 // See how much we should pad in the beginning 331 337 $pad = intval(date('w', $unixmonth)); 332 if (0 != $pad) echo "\n\t<td c lass='empty' colspan='$pad'> </td>";338 if (0 != $pad) echo "\n\t<td colspan='$pad'> </td>"; 333 339 334 340 $daysinmonth = intval(date('t', $unixmonth)); 335 341 for ($day = 1; $day <= $daysinmonth; ++$day) { 336 if ($newrow) echo "\n </tr>\n <tr>";342 if ($newrow) echo "\n </tr>\n <tr>\n\t"; 337 343 $newrow = false; 338 echo "\n\t<td>"; 344 345 if ($day == date('j', (time() + ($time_difference * 3600)))) echo '<td id="today">'; 346 else echo "<td>"; 339 347 340 348 if (in_array($day, $daywithpost)) { -
trunk/index.php
r470 r510 90 90 </li> 91 91 <li>Calendar: 92 <ul> 93 <li> 94 <?php include_once('b2calendar.php')?> 95 </li> 96 </ul> 92 <?php get_calendar(); ?> 97 93 </li> 98 94 <li>Other: -
trunk/wp-layout.css
r507 r510 1 1 /* Default WordPress by Dave Shea || http://mezzoblue.com 2 Tweakedby Matthew Mullenweg || http://photomatt.net2 Modifications by Matthew Mullenweg || http://photomatt.net 3 3 This is just a basic layout, with only the bare minimum defined. 4 4 Please tweak this and make it your own. :) … … 74 74 } 75 75 76 .b2calendarcell {77 color: #000;78 }79 80 .b2calendaremptycell {81 }82 83 .b2calendarheadercell {84 background: #808080;85 color: #ccc;86 }87 88 .b2calendarlinkpost {89 color: #f00;90 text-decoration: none;91 }92 93 .b2calendarmonth {94 color: #aaa;95 }96 97 .b2calendarrow {98 color: #0f0;99 }100 101 .b2calendartable {102 background: #fff;103 border: 1px solid #000;104 }105 106 .b2calendartoday {107 color: #00f;108 }109 76 110 77 .credit { … … 239 206 border-bottom: 1px solid #809080; 240 207 } 208 209 #wp-calendar { 210 border: 1px solid #ddd; 211 empty-cells: show; 212 font-size: 14px; 213 margin: 0; 214 width: 90%; 215 } 216 217 #wp-calendar #next a { 218 padding-right: 10px; 219 text-align: right; 220 } 221 222 #wp-calendar #prev a { 223 padding-left: 10px; 224 text-align: left; 225 } 226 227 #wp-calendar a { 228 display: block; 229 text-decoration: none; 230 } 231 232 #wp-calendar a:hover { 233 background: #e0e6e0; 234 color: #333; 235 } 236 237 #wp-calendar caption { 238 color: #999; 239 font-size: 16px; 240 } 241 242 #wp-calendar td { 243 color: #ccc; 244 font: normal 12px 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; 245 text-align: center; 246 padding: 2px 0; 247 letter-spacing: normal; 248 } 249 250 #wp-calendar td:hover, #wp-calendar #today { 251 background: #eee; 252 color: #bbb; 253 } 254 255 #wp-calendar th { 256 font-style: normal; 257 text-transform: capitalize; 258 }
Note: See TracChangeset
for help on using the changeset viewer.