-
Notifications
You must be signed in to change notification settings - Fork 2
Description
% tree app
app
├── assets
│ ├── config
│ │ └── manifest.js
│ ├── images
│ ├── javascripts
│ │ ├── application.js
│ │ ├── cable.js
│ │ ├── channels
│ │ └── google_analytics.js.coffee
│ └── stylesheets
│ ├── 1st_load_framework.css.scss
│ └── application.css.scss
├── channels
│ └── application_cable
│ ├── channel.rb
│ └── connection.rb
├── controllers
│ ├── application_controller.rb
│ ├── concerns
│ └── visitors_controller.rb
├── helpers
│ └── application_helper.rb
├── jobs
│ └── application_job.rb
├── mailers
│ └── application_mailer.rb
├── models
│ ├── application_record.rb
│ └── concerns
└── views
├── layouts
│ ├── application.html.haml
│ ├── mailer.html.erb
│ ├── mailer.text.erb
│ ├── _messages.html.haml
│ ├── _navigation.html.haml
│ └── _navigation_links.html.erb
├── pages
│ └── about.html.erb
└── visitors
└── index.html.erb
The "model" component tends to come from WordPress itself. But it might be useful to create our own models. i.e. if your site has a "Report" post type, have a Report class that's a subclass of the \WP_Post class, and includes static methods like ::query_posts() and ::get_post() - which then returns an array of Reports. (If this makes sense to do it should be a separate library - and there may already be a library like that out there). We could then pass that Report object into the Twig template.
We should be able to put WordPress's templates (templates/ currently) and Timber/Twig's templates into app/views/. Not sure how they could be divided though. But could we get rid of the templates/ directory as it currently exists and move that functionality into classes that then load a particular Twig view?
Do we have anything resembling a "controller" in WordPress land? 🤷♀️
And we could potentially have a directory reserved just for adding hooks.