Wrap the prefix in a span.

This commit is contained in:
Jeff Ong 2020-08-18 16:26:26 -04:00 committed by Jason Crist
parent 12d1b1ec32
commit dd7cf99d00

View file

@ -77,36 +77,41 @@ add_filter( 'comment_form_defaults', 'seedlet_comment_form_defaults' );
*/
function seedlet_get_the_archive_title( $title, $original_title, $prefix ) {
if ( is_category() ) {
$title = __( 'Category Archives: ', 'seedlet' ) . '<span class="page-description">' . single_term_title( '', false ) . '</span>';
$prefix = '<span class="archive-prefix">' . __( 'Category Archives: ', 'seedlet' ) . '</span>';
$title = '<span class="page-description">' . single_term_title( '', false ) . '</span>';
} elseif ( is_tag() ) {
$title = __( 'Tag Archives: ', 'seedlet' ) . '<span class="page-description">' . single_term_title( '', false ) . '</span>';
$prefix = '<span class="archive-prefix">' . __( 'Tag Archives: ', 'seedlet' ) . ' </span>';
$title = '<span class="page-description">' . single_term_title( '', false ) . '</span>';
} elseif ( is_author() ) {
$title = __( 'Author Archives: ', 'seedlet' ) . '<span class="page-description">' . get_the_author_meta( 'display_name' ) . '</span>';
$prefix = '<span class="archive-prefix">' . __( 'Author Archives: ', 'seedlet' ) . ' </span>';
$title = '<span class="page-description">' . get_the_author_meta( 'display_name' ) . '</span>';
} elseif ( is_year() ) {
$title = __( 'Yearly Archives: ', 'seedlet' ) . '<span class="page-description">' . get_the_date( _x( 'Y', 'yearly archives date format', 'seedlet' ) ) . '</span>';
$prefix = '<span class="archive-prefix">' . __( 'Yearly Archives: ', 'seedlet' ) . ' </span>';
$title = '<span class="page-description">' . get_the_date( _x( 'Y', 'yearly archives date format', 'seedlet' ) ) . '</span>';
} elseif ( is_month() ) {
$title = __( 'Monthly Archives: ', 'seedlet' ) . '<span class="page-description">' . get_the_date( _x( 'F Y', 'monthly archives date format', 'seedlet' ) ) . '</span>';
$prefix = '<span class="archive-prefix">' . __( 'Monthly Archives: ', 'seedlet' ) . ' </span>';
$title = '<span class="page-description">' . get_the_date( _x( 'F Y', 'monthly archives date format', 'seedlet' ) ) . '</span>';
} elseif ( is_day() ) {
$title = __( 'Daily Archives: ', 'seedlet' ) . '<span class="page-description">' . get_the_date() . '</span>';
$prefix = '<span class="archive-prefix">' . __( 'Daily Archives: ', 'seedlet' ) . ' </span>';
$title = '<span class="page-description">' . get_the_date() . '</span>';
} elseif ( is_post_type_archive() ) {
$prefix = '';
$cpt = get_post_type_object( get_queried_object()->name );
/* translators: %s: Post type singular name */
$title = sprintf( esc_html__( '%s Archives', 'seedlet' ),
$cpt->labels->singular_name
);
} elseif ( is_tax() ) {
$prefix = '';
$tax = get_taxonomy( get_queried_object()->taxonomy );
/* translators: %s: Taxonomy singular name */
$title = sprintf( esc_html__( '%s Archives', 'seedlet' ),
$tax->labels->singular_name
);
} else {
$title = __( 'Archives:', 'seedlet' );
$prefix = '';
$title = '<span class="archive-prefix">' . __( 'Archives: ', 'seedlet' ) . ' </span>';
}
return $title;
$prefix = '<span class="archive-prefix">' . $prefix . '</span>';
$title = '<span class="archive-title">' . $original_title . '</span>';
return '<h1 class="page-title">' . $prefix . $title . '</h1>';
}