Site icon Hip-Hop Website Design and Development

Restricting page templates by blog_id in multisite network

TL:DR; Is it possible to restrict page templates to a certain site within a multisite network? (Using something like get_current_blog_id for e.g)

More details

I’m building out several websites that each use the same base partials, just in different variations in their page templates. For e.g Site A & Site B’s home page both use Components A – D, however Site A’s goes A B C D and Site B’s goes C B A D. All my actual markup goes into the component partials and the page templates are mostly just a list of includes (using Roots Sage theme to help pass data).

This is the basic premise but we’re talking +-30 components and +-50 templates across 7 websites.

I’ve got all my templates in a subdirectory in my theme folder (e.g template-home-site-a, template-home-site-b) however this means when a user is working in the CMS for Site A they get a list of 50 templates, rather than just ones specific to Site A which might only be around 12.

Is there a way to possibly hook into WordPress’ templating system and add/remove folders it looks in based on the current blog ID? Open to any other suggestions.