Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

Commit

Permalink
Merge pull request #255 from DannyCooper/Improve-archive-header
Browse files Browse the repository at this point in the history
Improve archive header
  • Loading branch information
kjellr authored Oct 29, 2018
2 parents 8c4209b + d3fea02 commit 2713bc2
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 31 deletions.
3 changes: 2 additions & 1 deletion archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
<header class="page-header">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="page-description">', '</div>' );
// Remove for now @TODO
// the_archive_description( '<div class="page-description">', '</div>' );
?>
</header><!-- .page-header -->

Expand Down
37 changes: 7 additions & 30 deletions inc/template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,19 @@ function twentynineteen_comment_form_defaults( $defaults ) {
*/
function twentynineteen_get_the_archive_title() {
if ( is_category() ) {
$title = esc_html__( 'Category Archives:', 'twentynineteen' );
$title = esc_html__( 'Category Archives: ', 'twentynineteen' ) . '<span class="page-description">' . single_term_title( '', false ) . '</span>';
} elseif ( is_tag() ) {
$title = esc_html__( 'Tag Archives:', 'twentynineteen' );
$title = esc_html__( 'Tag Archives: ', 'twentynineteen' ) . '<span class="page-description">' . single_term_title( '', false ) . '</span>';
} elseif ( is_author() ) {
$title = esc_html__( 'Author Archives:', 'twentynineteen' );
$title = esc_html__( 'Author Archives: ', 'twentynineteen' ) . '<span class="page-description">' . get_the_author_meta( 'display_name' ) . '</span>';
} elseif ( is_year() ) {
$title = esc_html__( 'Yearly Archives:', 'twentynineteen' );
$title = esc_html__( 'Yearly Archives: ', 'twentynineteen' ) . '<span class="page-description">' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentynineteen' ) ) . '</span>';
} elseif ( is_month() ) {
$title = esc_html__( 'Monthly Archives:', 'twentynineteen' );
$title = esc_html__( 'Monthly Archives: ', 'twentynineteen' ) . '<span class="page-description">' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentynineteen' ) ) . '</span>';
} elseif ( is_day() ) {
$title = esc_html__( 'Daily Archives:', 'twentynineteen' );
$title = esc_html__( 'Daily Archives: ', 'twentynineteen' ) . '<span class="page-description">' . get_the_date() . '</span>';
} elseif ( is_post_type_archive() ) {
$title = esc_html__( 'Post Type Archives:', 'twentynineteen' );
$title = esc_html__( 'Post Type Archives: ', 'twentynineteen' ) . '<span class="page-description">' . post_type_archive_title( '', false ) . '</span>';
} elseif ( is_tax() ) {
$tax = get_taxonomy( get_queried_object()->taxonomy );
/* translators: %s: Taxonomy singular name */
Expand All @@ -95,29 +95,6 @@ function twentynineteen_get_the_archive_title() {
}
add_filter( 'get_the_archive_title', 'twentynineteen_get_the_archive_title' );

/**
* Filters the default archive descriptions.
*/
function twentynineteen_get_the_archive_description() {
if ( is_category() || is_tag() || is_tax() ) {
$description = single_term_title( '', false );
} elseif ( is_author() ) {
$description = get_the_author_meta( 'display_name' );
} elseif ( is_post_type_archive() ) {
$description = post_type_archive_title( '', false );
} elseif ( is_year() ) {
$description = get_the_date( _x( 'Y', 'yearly archives date format', 'twentynineteen' ) );
} elseif ( is_month() ) {
$description = get_the_date( _x( 'F Y', 'monthly archives date format', 'twentynineteen' ) );
} elseif ( is_day() ) {
$description = get_the_date();
} else {
$description = null;
}
return $description;
}
add_filter( 'get_the_archive_description', 'twentynineteen_get_the_archive_description' );

/**
* Determines if post thumbnail can be displayed.
*/
Expand Down
6 changes: 6 additions & 0 deletions sass/site/primary/_archives.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
}
}

.archive .page-header .page-description {
display: block;
color: $color__text-main;
font-size: 1em;
}

.hfeed .entry .entry-header {

@include media(tablet) {
Expand Down
6 changes: 6 additions & 0 deletions style-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -2583,6 +2583,12 @@ body.page .main-navigation {
color: #767676;
}

.archive .page-header .page-description {
display: block;
color: #111;
font-size: 1em;
}

@media only screen and (min-width: 768px) {
.hfeed .entry .entry-header {
margin: calc(3 * 1rem) calc(2 * (100vw / 12)) calc(1rem / 2);
Expand Down
6 changes: 6 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2583,6 +2583,12 @@ body.page .main-navigation {
color: #767676;
}

.archive .page-header .page-description {
display: block;
color: #111;
font-size: 1em;
}

@media only screen and (min-width: 768px) {
.hfeed .entry .entry-header {
margin: calc(3 * 1rem) calc(2 * (100vw / 12)) calc(1rem / 2);
Expand Down

0 comments on commit 2713bc2

Please sign in to comment.