Ticket #14161: 14161.patch
File 14161.patch, 3.0 KB (added by , 14 years ago) |
---|
-
general-template.php
517 517 global $wpdb, $wp_locale, $wp_query; 518 518 519 519 $cat = get_query_var('cat'); 520 $category_name = get_query_var('category_name'); 520 521 $tag = get_query_var('tag_id'); 521 $ category_name = get_query_var('category_name');522 $taxonomy = get_query_var('taxonomy'); 522 523 $author = get_query_var('author'); 523 524 $author_name = get_query_var('author_name'); 524 525 $m = get_query_var('m'); … … 548 549 $title = apply_filters('single_cat_title', $cat->name); 549 550 } 550 551 552 // If there's a tag 551 553 if ( !empty($tag) ) { 552 554 $tag = get_term($tag, 'post_tag', OBJECT, 'display'); 553 555 if ( is_wp_error( $tag ) ) … … 574 576 $title = $my_year . ($my_month ? $t_sep . $my_month : "") . ($my_day ? $t_sep . $my_day : ""); 575 577 } 576 578 579 // If there's a year 577 580 if ( !empty($year) ) { 578 581 $title = $year; 579 582 if ( !empty($monthnum) ) … … 590 593 591 594 // If there's a taxonomy 592 595 if ( is_tax() ) { 593 $taxonomy = get_query_var( 'taxonomy' );594 596 $tax = get_taxonomy( $taxonomy ); 595 597 $term = $wp_query->get_queried_object(); 596 598 $term = $term->name; … … 603 605 $title = sprintf(__('Search Results %1$s %2$s'), $t_sep, strip_tags($search)); 604 606 } 605 607 608 //If it's a 404 page 606 609 if ( is_404() ) { 607 610 $title = __('Page not found'); 608 611 } … … 722 725 */ 723 726 function single_tag_title($prefix = '', $display = true ) { 724 727 global $wp_query; 728 725 729 if ( !is_tag() ) 726 730 return; 727 731 728 732 $tag = $wp_query->get_queried_object(); 729 733 730 if ( ! 734 if ( !$tag ) 731 735 return; 732 736 733 737 $my_tag_name = apply_filters('single_tag_title', $tag->name); … … 740 744 } 741 745 742 746 /** 747 * Display or retrieve page title for taxonomy term archive. 748 * 749 * Useful for taxonomy term template files for displaying the taxonomy term page title. 750 * It has less overhead than {@link wp_title()}, because of its limited implementation. 751 * 752 * It does not support placing the separator after the title, but by leaving the 753 * prefix parameter empty, you can set the title separator manually. The prefix 754 * does not automatically place a space between the prefix, so if there should 755 * be a space, the parameter value will need to have it at the end. 756 * 757 * @since 3.0.1 758 * 759 * @param string $prefix Optional. What to display before the title. 760 * @param bool $display Optional, default is true. Whether to display or retrieve title. 761 * @return string|null Title when retrieving, null when displaying or failure. 762 */ 763 function single_term_title($prefix = '', $display = true ) { 764 global $wp_query; 765 766 if ( !is_term() ) 767 return; 768 769 $term = $wp_query->get_queried_object(); 770 771 if ( !$term ) 772 return; 773 774 $my_term_name = apply_filters('single_term_title', $term->name); 775 if ( !empty($my_term_name) ) { 776 if ( $display ) 777 echo $prefix . $my_term_name; 778 else 779 return $my_term_name; 780 } 781 } 782 783 /** 743 784 * Display or retrieve page title for post archive based on date. 744 785 * 745 786 * Useful for when the template only needs to display the month and year, if