wp-router
wp-router copied to clipboard
Unable to set template for root
When visiting the home page, / this template doesn't work:
$router = new MakeitWorkPress\WP_Router\Router(
[
'home' => ['route' => ''],
//'home' => ['route' => '/'], // Both don't work
]
);
So how should we use the router to set a template for the home page?
Is this because a a theme requires index.php to work, which is the home page template? If so, would be good to add that gotcha to the readme.
Yes, I believe a theme requires an index.php to work indeed. WordPress defaults to this if nothing is load. There's a filter hook though in WordPress to adjust the default location were WordPress is looking.