I know I can get rid of some of the default WP theme files required using
get_template_part() for instance. But some files still need to be present - for instance, how would I move page.php to a subfolder so it still works? I am also aware, that you can put you own page templates to a custom folder and they are being recognised normally.
I'm aware, that changing WP core hierarchy structure is probably not the best idea, but for developing specific pages (non-blog oriented) it just might be. I don't see how having many files in theme root is a good thing when you are trying to easily add a feature.
I know there are some similar questions out here, but none pointed to actual examples. Here are some:
- How do i structure my theme folder to avoid one huge list of files
- Can I put my Wordpress theme files in another folder?
But can someone show an example of how to organise theme folder so that I would end up only with (roughly)
- mytheme -- functions -- img -- js -- styles -- languages -- custom-templates --- template-demo.php --- ... -- wp_template_parts --- loop.php --- pagination.php --- comments.php --- header.php --- footer.php --- sidebar.php --- ... -- wp_default_view_templates --- page.php --- single.php --- 404.php --- search.php --- archive.php --- ... -- index.php -- functions.php -- style.css
where (for example)
wp_default_view_templates folder consists of only WP default hierarchy templates.
wp_template_parts includes default WP partials used multiple times.
(this already works via get_template_part())
views folder would include my custom page templates such as template-customstuff.php etc.
I have functions and assets such as css/js managed all right now. The only thing bothering me still are all the WP files in the root of the theme.
Is this reorganisation really such a bad idea?