Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms

You should be able to use what you have and just wrap it with:

<?php if ( is_year( ) ) { ?> **Your Code** <?php } ?>

And changing 'hide_empty' => false to 'hide_empty' => 1 should prevent the cats with no posts from showing.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)