I am switching from a custom theme starter to Sage 9, loving the blade engine, webpack etc.
Previously i used to organize data manipulations functions, actions and filters inside classes, named by template or CPT.
Now in Sage 9 i am trying to use sober/controller to manage all data manipulations outside templates, but i am still wondering where to put actions and filters for a specific template or custom post type?
filters.php file seems a bit too general to keep all actions and filters if my theme gets big.
I guess i am looking for something similar to sober/controller but for actions and filters, to be run automatically based on the Template Hierarchy.
What’s your workflow?
I am also switching to Sage 9 (and blade) and I am not sure where WP queries should go.
For a template for a particular post type I need to perform additional queries with WP Query - to what file does this code belong and how can the result be made available as variable to the blade template?
This is without a doubt what you’re looking for @strarsis https://github.com/soberwp/controller
@tcharbit, you can create your own files in the
app folder, and then add them to the array in
line: 58 of the
resources/functions.php file. I think that’s generally the best approach.
@zackcote: The controller is meant to be installed as requirement of the sage based theme?
In the end the theme should be just installed + activated without further preparations required.
Hmmm ok i think I will try to implement something on my own in a similar fashion as sober/controller.