Home › Forums › Calendar Products › Events Calendar PRO › Multisite Templates Location
- This topic has 5 replies, 2 voices, and was last updated 10 years, 7 months ago by
Barry.
-
AuthorPosts
-
September 19, 2015 at 12:34 pm #1006807
Dan Feeley
ParticipantWe want to start looking into Multisite, we will be using a child theme for each site. My question is, what are my choices for template override files?
- If i put them in the main theme directory and the theme gets updated the directory gets deleted.
- if I overwrite the core plugin files and the plugin gets updated I lose all the changes
- If I copy them to each child site then every time I make a change I need to update each child site
Is there any other way to store these files but will allow me a central place to maintain them?
Thank You.
September 21, 2015 at 9:14 am #1007082Barry
MemberHi Dan,
With a small customization or two it’s possible to store your templates almost anywhere – whether that’s a custom directory, a custom plugin directory or something else.
The tribe_events_template_TEMPLATE (for specific template files) and tribe_events_template (more generic) hooks provide an opportunity to change the filepath of each template that is loaded by The Events Calendar and its associated plugins, so you can remap everything to whatever location you prefer.
Example:
function remap_event_templates( $filepath ) { return str_replace( '/expected/basepath/', '/path/to/new/home/', $filepath ); } add_filter( 'tribe_events_template', 'remap_event_templates' );This is a pretty simple example and you could tweak as required if you have a more complicated use case or need to make exceptions, etc.
September 28, 2015 at 3:45 am #1009116Dan Feeley
ParticipantBarry,
Thanks for the snippet. I’m having a bit of a problem getting it to work. Just to make sure I have it correct, is the “/expected/basepath/” listed above the path to where the modified templates are normally (e.g. ../themes/my-theme/tribe-events/)?
September 28, 2015 at 9:59 am #1009293Barry
MemberHi Dan,
So “/expected/basepath/” will be whatever The Events Calendar has decided is the location of the template it wants to load.
In a simple case where you have no template overrides then that will be the path to the plugin’s own views directory. In a more complicated case where you have some template overrides (but not everything is overridden) it will alternately point to either the plugin’s views directory or the tribe-events subdirectory within your theme.
Does that help?
October 2, 2015 at 5:15 am #1010813Dan Feeley
ParticipantThanks Barry,
That’s what I had assumed (and was trying to do). I must just have a formatting error.
I don’t want to hold this ticket up but I’ll need to revisit this later when time allows.Thanks for the help, if I have any other questions I will open up another ticket.
October 2, 2015 at 9:02 am #1010968Barry
MemberGreat 🙂
-
AuthorPosts
- The topic ‘Multisite Templates Location’ is closed to new replies.
