- Timestamp:
- 11/02/2020 07:43:07 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentytwentyone/inc/template-functions.php
r49330 r49478 93 93 } 94 94 add_filter( 'comment_form_defaults', 'twenty_twenty_one_comment_form_defaults' ); 95 96 /**97 * Filters the default archive titles.98 *99 * @since 1.0.0100 *101 * @return string102 */103 function twenty_twenty_one_get_the_archive_title() {104 if ( is_category() ) {105 return sprintf(106 /* translators: %s: The term title. */107 esc_html__( 'Category Archives: %s', 'twentytwentyone' ),108 '<span class="page-description">' . single_term_title( '', false ) . '</span>'109 );110 }111 112 if ( is_tag() ) {113 return sprintf(114 /* translators: %s: The term title. */115 esc_html__( 'Tag Archives: %s', 'twentytwentyone' ),116 '<span class="page-description">' . single_term_title( '', false ) . '</span>'117 );118 }119 120 if ( is_author() ) {121 return sprintf(122 /* translators: %s: The author name. */123 esc_html__( 'Author Archives: %s', 'twentytwentyone' ),124 '<span class="page-description">' . get_the_author_meta( 'display_name' ) . '</span>'125 );126 }127 128 if ( is_year() ) {129 return sprintf(130 /* translators: %s: The year. */131 esc_html__( 'Yearly Archives: %s', 'twentytwentyone' ),132 '<span class="page-description">' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentytwentyone' ) ) . '</span>'133 );134 }135 136 if ( is_month() ) {137 return sprintf(138 /* translators: %s: The month. */139 esc_html__( 'Monthly Archives: %s', 'twentytwentyone' ),140 '<span class="page-description">' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentytwentyone' ) ) . '</span>'141 );142 }143 144 if ( is_day() ) {145 return sprintf(146 /* translators: %s: The day. */147 esc_html__( 'Daily Archives: %s', 'twentytwentyone' ),148 '<span class="page-description">' . get_the_date() . '</span>'149 );150 }151 152 if ( is_post_type_archive() ) {153 return sprintf(154 /* translators: %s: Post type singular name. */155 esc_html__( '%s Archives', 'twentytwentyone' ),156 get_post_type_object( get_queried_object()->name )->labels->singular_name157 );158 }159 160 if ( is_tax() ) {161 return sprintf(162 /* translators: %s: Taxonomy singular name. */163 esc_html__( '%s Archives', 'twentytwentyone' ),164 get_taxonomy( get_queried_object()->taxonomy )->labels->singular_name165 );166 }167 168 return esc_html__( 'Archives:', 'twentytwentyone' );169 }170 add_filter( 'get_the_archive_title', 'twenty_twenty_one_get_the_archive_title' );171 95 172 96 /** … … 488 412 */ 489 413 function twenty_twenty_one_get_attachment_image_attributes( $attr, $attachment, $size ) { 414 415 if ( isset( $attr['class'] ) && false !== strpos( $attr['class'], 'custom-logo' ) ) { 416 return $attr; 417 } 418 490 419 $width = false; 491 420 $height = false; … … 506 435 // Add style. 507 436 $attr['style'] = isset( $attr['style'] ) ? $attr['style'] : ''; 508 $attr['style'] = 'width:100%;height:' . round( 100 * $ meta['height'] / $meta['width'], 2 ) . '%;' . $attr['style'];437 $attr['style'] = 'width:100%;height:' . round( 100 * $height / $width, 2 ) . '%;' . $attr['style']; 509 438 } 510 439
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)