WordPress decides which template file to load for any given URL using a specific, documented order of checks. Most developers learn it by trial and error rather than actually reading it, which leads to confusing bugs like “why is my custom category page using archive.php instead of the file I made.”
The order, roughly, for a category archive
category-{slug}.php
category-{id}.php
category.php
archive.php
index.php
WordPress checks each in order and uses the first one that exists in your theme. If you created archive.php but not category.php, and you actually wanted category-specific markup, that’s exactly why your changes aren’t showing up — a more specific file further up the chain doesn’t exist, but neither does the one you edited relative to what’s actually being matched.
Checking which template is actually loading
Rather than guessing, ask WordPress directly:
add_action('wp_footer', function() {
if (current_user_can('manage_options')) {
echo '<!-- Template: ' . get_page_template_slug() . ' / ' . basename(get_the_template()) . ' -->';
}
});
This prints an HTML comment visible in view-source, only for admins, showing exactly which file rendered the page — genuinely faster than reading through the hierarchy docs every time you’re debugging.
Custom page templates
<?php
/* Template Name: Full Width Landing */
get_header(); ?>
<main class="full-width">
<?php while (have_posts()): the_post(); the_content(); endwhile; ?>
</main>
<?php get_footer();
This becomes selectable in the Page Attributes panel in the editor once the file exists in your theme with that comment header — no registration function needed, WordPress scans for the comment automatically.
Knowing the hierarchy well enough to predict which file loads, rather than checking after the fact, is genuinely one of the more useful things to actually memorize about WordPress theme development.