Last active
October 31, 2017 13:08
-
-
Save mustafix/8666f688c9d090b523ac62055d1334c7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
if( is_category() ){ | |
single_cat_title(); | |
}elseif( is_tag() ){ | |
single_tag_title(); | |
}elseif( is_author() ){ | |
the_post(); | |
echo 'Author Archive: '.get_the_author(); | |
rewind_posts(); | |
}elseif( is_day() ){ | |
echo 'Day Archive: '.get_the_date(); | |
}elseif(is_month() ){ | |
echo 'Month Archive: '.get_the_date('F,y'); | |
}elseif( is_year() ){ | |
echo 'Year Archive: '.get_the_date('Y'); | |
}else{ | |
echo 'Archive : '; | |
} | |
?> | |
or | |
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> | |
<?php /* If this is a category archive */ if (is_category()) { ?> | |
<?php _e('Archive for the'); ?> '<?php echo single_cat_title(); ?>' <?php _e('Category'); ?> | |
<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?> | |
<?php _e('Archive for the'); ?> <?php single_tag_title(); ?> Tag | |
<?php /* If this is a daily archive */ } elseif (is_day()) { ?> | |
<?php _e('Archive for'); ?> <?php the_time('F jS, Y'); ?> | |
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?> | |
<?php _e('Archive for'); ?> <?php the_time('F, Y'); ?> | |
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?> | |
<?php _e('Archive for'); ?> <?php the_time('Y'); ?> | |
<?php /* If this is a search */ } elseif (is_search()) { ?> | |
<?php _e('Search Results'); ?> | |
<?php /* If this is an author archive */ } elseif (is_author()) { ?> | |
<?php _e('Author Archive'); ?> | |
<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> | |
<?php _e('Blog Archives'); ?> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment