Last active
November 16, 2016 03:57
-
-
Save billerickson/4832c9e21a96e80e8bd9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Header for Date Archives | |
* | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/code/header-date-archives/ | |
*/ | |
function be_date_archive_header() { | |
if( ! is_date() ) | |
return; | |
if( is_year() ) | |
$title = get_query_var( 'year' ); | |
if( is_month() ) | |
$title = single_month_title( ' ', false ); | |
if( is_day() ) { | |
$date = get_query_var( 'day' ) . single_month_title( ' ', false ); | |
$title = date( 'F j, Y', strtotime( $date ) ); | |
} | |
if( $title ) | |
echo '<h1 class="archive-title">' . $title . '</h1>'; | |
} | |
add_action( 'genesis_before_loop', 'be_date_archive_header' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment