Inspect get_queried_object()
.
On an archive for the category Uncategorized
you get something like …
stdClass Object
(
[term_id] => 1
[name] => Uncategorized
[slug] => uncategorized
[term_group] => 0
[term_taxonomy_id] => 1
[taxonomy] => category
Find out in which kind of archive am I =>
[parent] => 0
[count] => 8
[cat_ID] => 1
[category_count] => 8
[category_description] =>
[cat_name] => Uncategorized
[category_nicename] => uncategorized
[category_parent] => 0
)
… and on an archive for the tag test
…
stdClass Object
(
[term_id] => 18
[name] => test
[slug] => test-2
[term_group] => 0
[term_taxonomy_id] => 18
[taxonomy] => post_tag
Find out in which kind of archive am I =>
[parent] => 0
[count] => 1
)
So you can test if a property taxonomy
for that object exists and what the value is. Then adjust your template.