this is done without any code, in the dashboard using the template presented or any other and has no need for the function added to functions.php.
try this steps:
- Pages > add new: create new page with any name adding the title and publish;
- Pages > all pages > quick-edit(on the page created): on templates choose the page template of choice, for example “front-page” and update;
- Appearance > customize > homepage settings: on the ”
Your homepage displays” choose “a static page”, on “home page” choose your page created that now displays your template and update.
this should set your home page.