| 793 | * Retrieve or display the archive title based on the queried object |
| 794 | * |
| 795 | * @since 3.5.0 |
| 796 | * |
| 797 | * @return string Text archive title |
| 798 | */ |
| 799 | function the_archive_title( $prefix = '', $display = true ) { |
| 800 | if ( is_day() ) { |
| 801 | $title = printf( __( 'Daily Archives: %s' ), '<span>' . get_the_date() . '</span>' ); |
| 802 | } elseif ( is_month() ) { |
| 803 | $title = printf( __( 'Monthly Archives: %s' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format' ) ) . '</span>' ); |
| 804 | } elseif ( is_year() ) { |
| 805 | $title = printf( __( 'Yearly Archives: %s' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format' ) ) . '</span>' ); |
| 806 | } elseif ( is_tag() ) { |
| 807 | $title = printf( __( 'Tag Archives: %s' ), '<span>' . single_tag_title( '', false ) . '</span>' ); |
| 808 | } elseif ( is_category() ) { |
| 809 | $title = printf( __( 'Category Archives: %s' ), '<span>' . single_cat_title( '', false ) . '</span>' ); |
| 810 | } elseif ( is_tax() ) { |
| 811 | $title = printf( __( 'Taxonomy Archives: %s' ), '<span>' . single_term_title( '', false ) . '</span>' ); |
| 812 | } elseif ( is_author() ) { |
| 813 | $title = printf( __( 'Author Archives: %s' ), '<span>' . get_the_author() . '</span>' ); |
| 814 | } elseif ( is_post_type_archive() ) { |
| 815 | $title = printf( __( 'Archives: %s' ), '<span>' . post_type_archive_title( '', false ) . '</span>' ) ; |
| 816 | } else { |
| 817 | $title = _e( 'Archives' ); |
| 818 | } |
| 819 | |
| 820 | $title = $prefix . $title; |
| 821 | |
| 822 | if ( $display ) |
| 823 | echo apply_filters( 'the_archive_title', $title ); |
| 824 | else |
| 825 | return apply_filters( 'the_archive_title', $title ); |
| 826 | } |
| 827 | |
| 828 | /** |
| 829 | * Retrieve or display tag, category or term description |
| 830 | * |
| 831 | * @since 3.5.0 |
| 832 | * |
| 833 | * @uses term_description() |
| 834 | * @return string Category, tag or term description |
| 835 | */ |
| 836 | function the_archive_description( $display = true ) { |
| 837 | if ( is_tag() || is_category() || is_tax() ) { |
| 838 | $term = get_queried_object(); |
| 839 | $taxonomy = $term->taxonomy; |
| 840 | $description = term_description( '', $taxonomy ); |
| 841 | } |
| 842 | |
| 843 | if ( $display ) |
| 844 | echo apply_filters( 'the_archive_description', $description ); |
| 845 | else |
| 846 | return apply_filters( 'the_archive_description', $description ); |
| 847 | } |
| 848 | |
| 849 | /** |