Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set template for root #2

Closed
drewbaker opened this issue Jul 31, 2024 · 1 comment
Closed

Unable to set template for root #2

drewbaker opened this issue Jul 31, 2024 · 1 comment

Comments

@drewbaker
Copy link

drewbaker commented Jul 31, 2024

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.

@leichim
Copy link
Member

leichim commented Aug 7, 2024

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.

@leichim leichim closed this as completed Aug 7, 2024
@leichim leichim reopened this Aug 7, 2024
@leichim leichim closed this as completed Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants