Ticket #7463: 7463.diff
| File 7463.diff, 3.3 KB (added by ionfish, 5 years ago) |
|---|
-
wp-includes/formatting.php
1501 1501 return '<' . $tag . $link . ' target="' . $target . '">'; 1502 1502 } 1503 1503 1504 /** 1505 * Implodes an array and adds a final conjuction. 1506 * 1507 * Given the array <code>array('John', 'Paul', 'George', 'Ringo')</code> it will 1508 * return the string <code>'John, Paul, George and Ringo'</code>. 1509 * 1510 * @package WordPress 1511 * @since 2.7 1512 * 1513 * @internal 1514 * @param array $array 1515 * @param string $glue 1516 * @param string $conjuction 1517 * @return string 1518 */ 1519 function _implode_nicely( $array, $glue = ', ', $conjuction = 'and' ) { 1520 if ( !is_array($array) || count($array) == 0 ) 1521 return; 1522 1523 $last_value = array_pop($array); 1524 1525 if ( count($array) > 0 ) 1526 $output = implode($glue, $array) . " $conjuction $last_value"; 1527 else 1528 $output = $last_value; 1529 1530 return $output; 1531 } 1532 1504 1533 ?> -
wp-includes/general-template.php
331 331 } 332 332 333 333 334 /** 335 * Outputs tag titles for tag intersections and unions. 336 * 337 * @package WordPress 338 * @since 2.7 339 * 340 * @global $wpdb object 341 * @param $tag_wrapper string 342 * @return string 343 */ 344 function multiple_tag_titles($format = '‘%s’') { 345 global $wpdb; 346 347 if ( !is_tag() ) 348 return; 349 350 if ( $tag_slugs = get_query_var('tag_slug__and') ) 351 $connective = __('and'); 352 elseif ( $tag_slugs = get_query_var('tag_slug__in') ) 353 $connective = __('or'); 354 else 355 $single_tag = intval( get_query_var('tag_id') ); 356 357 $tags = array(); 358 if ( $tag_slugs ) { 359 foreach ( $tag_slugs as $tag_slug ) { 360 $tag = get_term_by('slug', $tag_slug, 'post_tag', OBJECT, 'display'); 361 if ( !is_wp_error($tag) && !empty($tag->name) ) 362 $tags[] = $tag->name; 363 } 364 } elseif ( $single_tag ) { 365 $tag = &get_term($single_tag, 'post_tag', OBJECT, 'display'); 366 if ( is_wp_error($tag) || empty($tag->name) ) 367 return false; 368 else 369 $tags[] = $tag->name; 370 } else { 371 return; 372 } 373 374 if ( strlen($format) > 0 ) { 375 foreach ( $tags as $index => $tag ) 376 $tags[$index] = sprintf($format, $tag); 377 } 378 379 $tags = _implode_nicely($tags, __(', '), $connective); 380 $tags = apply_filters('multiple_tag_titles', $tags); 381 return $tags; 382 } 383 384 334 385 function single_month_title($prefix = '', $display = true ) { 335 386 global $wp_locale; 336 387 -
wp-content/themes/default/archive.php
8 8 <?php /* If this is a category archive */ if (is_category()) { ?> 9 9 <h2 class="pagetitle">Archive for the ‘<?php single_cat_title(); ?>’ Category</h2> 10 10 <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?> 11 <h2 class="pagetitle">Posts Tagged ‘<?php single_tag_title(); ?>’</h2>11 <h2 class="pagetitle">Posts Tagged <?php echo multiple_tag_titles(); ?></h2> 12 12 <?php /* If this is a daily archive */ } elseif (is_day()) { ?> 13 13 <h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2> 14 14 <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>