Greetings and thanks in advance.
How can I create a middleware that detects a subdomain and passes it as $ _GET type argument?
For example: london.mysite.com => mysite.com/q=london
get().. either use
The situation is like this:
I pass all front-end requests through WPEmerge -
MyApp::route()->all() so when I invoke some regular page, a view
wp-content\themes\my-theme\views\page.php is automatically displayed.
I'm wondering how to achieve this:
I like this route -> controller -> view schema, but I don't want to create routes for all standard WP URLs .
I'd like to have some controller(s) in the middle to inject some data (variables) when needed to some of the standard-route-views.
How can I create a controller that would be automatically invoked for those standard WP routes before (in this case the page.php) view is served?
Should I use middleware for that? One method that would check what route is this and delegate handling of this request to some dedicated classes?