Custom html output template overide from plugin

Hello,
I had several times this kind of problem: there are quite a few plugins that allows templating through creating a folder in the root theme with a specific name containing php template such as flexible posts widget ( https://wordpress.org/plugins/flexible-posts-widget/#installation). I’ve used it quite often but with sage, i’m confused: I’ve tried to put this folder at the theme root as recommended, or inside the views folder, or even in the app folder… without success !
So I guess it is something else.
Any help with this ?
Thank you,
F

Did you try the resources folder?

Damned ! Stupide me… Thank you :wink:
I missed the one that works !

1 Like

Don’t be hard on yourself. I think this deserves a bit more explanation as to why it works this way.

Since WordPress can find a theme in a subdirectory Sage is able to move core theme files like style.css and functions.php to the resources directory. That directory is recognized by WordPress as the theme. This is why if you ever use WP-CLI to list the themes (wp theme list), it will display the name of your Sage theme like this:

+-----------------+----------+--------+---------+
| name            | status   | update | version |
+-----------------+----------+--------+---------+
| sage/resources  | active   | none   | 9.0.0   |
| twentyfifteen   | inactive | none   | 1.9     |
| twentyseventeen | inactive | none   | 1.5     |
| twentysixteen   | inactive | none   | 1.4     |
+-----------------+----------+--------+---------+

There’s a helpful comment in the functions.php which explains what happens.
https://github.com/roots/sage/blob/master/resources/functions.php#L63-L79

3 Likes