Ticket #21995: 21995.diff

File 21995.diff, 2.4 KB (added by DrewAPicture, 8 months ago)

Suggested first-run

Line 
1Index: wp-includes/general-template.php
2===================================================================
3--- wp-includes/general-template.php    (revision 22002)
4+++ wp-includes/general-template.php    (working copy)
5@@ -790,6 +790,63 @@
6 }
7 
8 /**
9+ * Retrieve or display the archive title based on the queried object
10+ *
11+ * @since 3.5.0
12+ *
13+ * @return string Text archive title
14+ */
15+function the_archive_title( $prefix = '', $display = true ) {
16+       if ( is_day() ) {
17+               $title = printf( __( 'Daily Archives: %s' ), '<span>' . get_the_date() . '</span>' );
18+       } elseif ( is_month() ) {
19+               $title = printf( __( 'Monthly Archives: %s' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format' ) ) . '</span>' );
20+       } elseif ( is_year() ) {
21+               $title = printf( __( 'Yearly Archives: %s' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format' ) ) . '</span>' );
22+       } elseif ( is_tag() ) {
23+               $title = printf( __( 'Tag Archives: %s' ), '<span>' . single_tag_title( '', false ) . '</span>' );
24+       } elseif ( is_category() ) {
25+               $title = printf( __( 'Category Archives: %s' ), '<span>' . single_cat_title( '', false ) . '</span>' );
26+       } elseif ( is_tax() ) {
27+               $title = printf( __( 'Taxonomy Archives: %s' ), '<span>' . single_term_title( '', false ) . '</span>' );
28+       } elseif ( is_author() ) {
29+               $title = printf( __( 'Author Archives: %s' ), '<span>' . get_the_author() . '</span>' );
30+       } elseif ( is_post_type_archive() ) {
31+               $title = printf( __( 'Archives: %s' ), '<span>' . post_type_archive_title( '', false ) . '</span>' ) ;
32+       } else {
33+               $title = _e( 'Archives' );
34+       }
35+       
36+       $title = $prefix . $title;
37+
38+       if ( $display )
39+               echo apply_filters( 'the_archive_title', $title );
40+       else
41+               return apply_filters( 'the_archive_title', $title );
42+}
43+
44+/**
45+ * Retrieve or display tag, category or term description
46+ *
47+ * @since 3.5.0
48+ *
49+ * @uses term_description()
50+ * @return string Category, tag or term description
51+ */
52+function the_archive_description( $display = true ) {
53+       if ( is_tag() || is_category() || is_tax() ) {
54+               $term = get_queried_object();
55+               $taxonomy = $term->taxonomy;           
56+               $description = term_description( '', $taxonomy );
57+       }
58+
59+       if ( $display )
60+               echo apply_filters( 'the_archive_description', $description );
61+       else
62+               return apply_filters( 'the_archive_description', $description );
63+}
64+
65+/**
66  * Retrieve archive link content based on predefined or custom code.
67  *
68  * The format can be one of four styles. The 'link' for head element, 'option'