One of the most important things to learn when you are making a WordPress theme is the WordPress Template hierarchy for themes. The template hierarchy defines what template file that will be loaded for each request and in what order. If the first template does not exist in the hierarchy WordPress wi...
Its easy to get lost while debugging the hiearchy. You can use PHP's built in command debug_backtrace.
Put the next snippet inside any template you want to debug and view the generated page:
<!--
<?php print_r( debug_backtrace() ) ?>
-->