Created
February 7, 2014 04:07
-
-
Save cassler/8857248 to your computer and use it in GitHub Desktop.
Show the proper H1 based on context
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 function den_page_title() { | |
$post = $posts[0]; // Hack. Set $post so that the_date() works. | |
/* If this is a category archive */ | |
if (is_category()) { | |
echo '<h1>Archive for the ‘' . single_cat_title() . '’ Category</h1>'; | |
} elseif( is_tag() ) { // If is tag archive | |
echo '<h1>Posts Tagged ‘' . single_tag_title(); . '’</h1>'; | |
/* If this is a daily archive */ | |
} elseif (is_day()) { | |
echo '<h1>Archive for ' . the_time('F jS, Y'); '</h1>'; | |
/* If this is a monthly archive */ | |
} elseif (is_month()) { | |
echo '<h1>Archive for ' . the_time('F, Y'); '</h1>'; | |
/* If this is a yearly archive */ | |
} elseif (is_year()) { | |
echo '<h1>Archive for ' . the_time('Y'); '</h1>'; | |
/* If this is an author archive */ | |
} elseif (is_author()) { | |
echo '<h1>Author Archive</h1>' | |
/* If this is a paged archive */ | |
} elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { | |
echo '<h1>Blog Archives</h1>'; | |
} | |
} ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is primarily for your archive.php template but works on index.php too.