I tried using

archive.php and category.php

but always index.php is used of my template. How can I customize what template file is used?

2 Answers 2


get_month_link() doesn't use any template. It just creates a link to date based archives. The actual template used is decided by a rather complicated template hierarchy system managed by Core. Essentially there is a cascading sequence of files that will be used if those files are provided by the theme:

  1. date.php
  2. archive.php
  3. index.php

I think I did a mistake with my IDE. It turns out "archive.php" actually gets triggered.

I think i didn't deploy it correctly. I am still not entirely sure what template hierarchies are called though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.