I’m struggling for days to change the index.php. I wan’t to create a blogroll without the sidebar and include a hero image above the post query. I tried several thing for example:
create a new template and call the index.php - result: still the old template
create a new template and do a custom query in the template - result: empty page
It’s returning the posts. But it’s not returning the H1 from base-archive.php or base-template-archive.php. It’s still getting it’s layout from base.php.
The reason why template-archive.php will not load base-archive.php is because you dropped part of the template name.
All you ever need to do is prefix base- to the full template name e.g. base-template-archive.php will load when template-archive.php loads.
You should also re-read the template hierarchy as it’s likely home.php or archive.php would be a better place to start when customising your blog pages.
Thanks for your quick response! As mentioned at the bottom of my previous response I tried the right convention template-archive.php. Still it loads the base.php. I wan’t to make a change to the header and footer layout for the blog page, changing only the archive.php doesn’t bring me succes.
If what I posted isn’t working then it’s because template-archive.php isn’t being loaded.
Have you set your page as the “posts page” in the dashboard? If so you will need to start with home.php as I mentioned above. The WordPress template hierarchy will only ever use home.php or index.php for the “posts page”. All other templates are ignored, including custom page templates. It’ll be mentioned on the codex somewhere if you search.