Skip to content

Instantly share code, notes, and snippets.

@jserrao
Created December 14, 2015 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jserrao/0aadae4ecbac881170b5 to your computer and use it in GitHub Desktop.
Save jserrao/0aadae4ecbac881170b5 to your computer and use it in GitHub Desktop.
Conditional Wordpress Archive Check for archive.php
<?php
// A lot of this conditional checking is deprecated now with the_archive_title();
// See how it works here: https://developer.wordpress.org/reference/functions/get_the_archive_title/
// 1- Check for Date Archive
if (is_date() == true) {
}
// 2- Check for Tag Archive
elseif (is_tag() == true) {
}
// 3- Check for Category Archive
elseif (is_category() == true) {
}
// 4- Check for Taxonomy Archive
elseif (taxonomy_exists() == true) {
}
// 5- Check for Author Archive
elseif (is_author() == true) {
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment