Created
June 2, 2014 17:16
-
-
Save yellowberri-snippets/0f6575340868a78ec083 to your computer and use it in GitHub Desktop.
PHP: WP: Return Heading for Archive Pages : ybArchiveTitle()
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
// Return term of Archive Page. | |
function ybArchiveTitle() { | |
$archiveTitle = ""; | |
if ( is_category() ) { | |
$archiveTitle = single_cat_title('', FALSE); | |
} | |
elseif ( is_tag() ) { | |
$archiveTitle = single_tag_title('', FALSE); | |
} | |
elseif ( is_author() ) { | |
global $post; | |
$author_id = $post->post_author; | |
$archiveTitle = get_the_author_meta('display_name', $author_id); | |
} elseif ( is_day() ) { | |
$archiveTitle = get_the_time('l, F j, Y'); | |
} elseif ( is_month() ) { | |
$archiveTitle = get_the_time('F Y'); | |
} elseif (is_year()) { | |
$archiveTitle = get_the_time('Y'); | |
} | |
return $archiveTitle; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment