I have created 2 pages inside wordpress “blog” and “hpage”, on the config I have set static front page to “hpage” as initial page and “blog” for posts index.
Now I want to create a “page-hpage.php” file to create a really especific front page. Looking for the template hierarchy I see that I can use “page-$slug.php”, but “page-hpage.php” just doesn’t work but if I use “page-$id.php” using the id of the “hpage” I work.
Now, If I install this template again the page is likely to not have the same ID again, so it will fail. What I’m doing wrong?
Use ‘front-page.php’ for your template. You can read more about it at https://codex.wordpress.org/Creating_a_Static_Front_Page
Or create a page template that you set in the editor. This will allow you to set it on any page and you’re not tied to the ID.
<?php /* Template Name: Example Template */ ?>