Ticket #31960: 31960.patch
File 31960.patch, 3.3 KB (added by , 10 years ago) |
---|
-
wp-includes/general-template.php
1277 1277 * @param string $after Optional. 1278 1278 * @return string HTML link content for archive. 1279 1279 */ 1280 function get_archives_link($url, $text, $format = 'html', $before = '', $after = '' ) {1280 function get_archives_link($url, $text, $format = 'html', $before = '', $after = '', $archive_index = '1') { 1281 1281 $text = wptexturize($text); 1282 1282 $url = esc_url($url); 1283 1283 … … 1285 1285 $link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n"; 1286 1286 elseif ('option' == $format) 1287 1287 $link_html = "\t<option value='$url'>$before $text $after</option>\n"; 1288 elseif ('html' == $format) 1289 $link_html = "\t<li>$before<a href='$url'>$text</a>$after</li>\n"; 1288 elseif ('html' == $format) { 1289 $class = 'archive-item archive-item-' . $archive_index; 1290 $link_html = "\t<li class='$class'>$before<a href='$url'>$text</a>$after</li>\n"; 1291 } 1290 1292 else // custom 1291 1293 $link_html = "\t$before<a href='$url'>$text</a>$after\n"; 1292 1294 … … 1406 1408 } 1407 1409 1408 1410 $limit = $r['limit']; 1411 1412 $archive_index = 1; 1409 1413 1410 1414 if ( 'monthly' == $r['type'] ) { 1411 1415 $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date $order $limit"; … … 1424 1428 if ( $r['show_post_count'] ) { 1425 1429 $r['after'] = ' (' . $result->posts . ')' . $after; 1426 1430 } 1427 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); 1431 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $archive_index ); 1432 $archive_index ++; 1428 1433 } 1429 1434 } 1430 1435 } elseif ( 'yearly' == $r['type'] ) { … … 1443 1448 if ( $r['show_post_count'] ) { 1444 1449 $r['after'] = ' (' . $result->posts . ')' . $after; 1445 1450 } 1446 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); 1451 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $archive_index ); 1452 $archive_index ++; 1447 1453 } 1448 1454 } 1449 1455 } elseif ( 'daily' == $r['type'] ) { … … 1463 1469 if ( $r['show_post_count'] ) { 1464 1470 $r['after'] = ' (' . $result->posts . ')' . $after; 1465 1471 } 1466 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); 1472 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $archive_index ); 1473 $archive_index ++; 1467 1474 } 1468 1475 } 1469 1476 } elseif ( 'weekly' == $r['type'] ) { … … 1490 1497 if ( $r['show_post_count'] ) { 1491 1498 $r['after'] = ' (' . $result->posts . ')' . $after; 1492 1499 } 1493 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); 1500 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $archive_index ); 1501 $archive_index ++; 1494 1502 } 1495 1503 } 1496 1504 } … … 1513 1521 } else { 1514 1522 $text = $result->ID; 1515 1523 } 1516 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); 1524 $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'], $archive_index ); 1525 $archive_index ++; 1517 1526 } 1518 1527 } 1519 1528 }