From 2ff74c25ed045ed6c5515e7daf46cdcf69c2c18b Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Wed, 25 Oct 2023 16:10:58 -0500 Subject: [PATCH] Update templates to use subdirectory structure. --- src/includes/class-gamajo-template-loader.php | 2 +- src/mc-templates/{event-card.php => event/card.php} | 0 src/mc-templates/{event-grid.php => event/grid.php} | 0 src/mc-templates/{event-list.php => event/list.php} | 0 src/mc-templates/{event-mini.php => event/mini.php} | 0 src/mc-templates/{event-next.php => event/next.php} | 0 src/mc-templates/{event-now.php => event/now.php} | 0 src/mc-templates/{event-single.php => event/single.php} | 0 src/mc-templates/{event-today.php => event/today.php} | 0 src/mc-templates/{event-upcoming.php => event/upcoming.php} | 0 src/mc-templates/{ => location}/location-single.php | 0 src/my-calendar-output.php | 4 ++-- src/my-calendar-widgets.php | 4 ++-- 13 files changed, 5 insertions(+), 5 deletions(-) rename src/mc-templates/{event-card.php => event/card.php} (100%) rename src/mc-templates/{event-grid.php => event/grid.php} (100%) rename src/mc-templates/{event-list.php => event/list.php} (100%) rename src/mc-templates/{event-mini.php => event/mini.php} (100%) rename src/mc-templates/{event-next.php => event/next.php} (100%) rename src/mc-templates/{event-now.php => event/now.php} (100%) rename src/mc-templates/{event-single.php => event/single.php} (100%) rename src/mc-templates/{event-today.php => event/today.php} (100%) rename src/mc-templates/{event-upcoming.php => event/upcoming.php} (100%) rename src/mc-templates/{ => location}/location-single.php (100%) diff --git a/src/includes/class-gamajo-template-loader.php b/src/includes/class-gamajo-template-loader.php index e84b38eb5..64f2eeefa 100644 --- a/src/includes/class-gamajo-template-loader.php +++ b/src/includes/class-gamajo-template-loader.php @@ -184,7 +184,7 @@ public function unset_template_data() { protected function get_template_file_names( $slug, $name = '' ) { $templates = array(); if ( ! empty( $name ) ) { - $templates[] = $slug . '-' . $name . '.php'; + $templates[] = $slug . '/' . $name . '.php'; } $templates[] = $slug . '.php'; diff --git a/src/mc-templates/event-card.php b/src/mc-templates/event/card.php similarity index 100% rename from src/mc-templates/event-card.php rename to src/mc-templates/event/card.php diff --git a/src/mc-templates/event-grid.php b/src/mc-templates/event/grid.php similarity index 100% rename from src/mc-templates/event-grid.php rename to src/mc-templates/event/grid.php diff --git a/src/mc-templates/event-list.php b/src/mc-templates/event/list.php similarity index 100% rename from src/mc-templates/event-list.php rename to src/mc-templates/event/list.php diff --git a/src/mc-templates/event-mini.php b/src/mc-templates/event/mini.php similarity index 100% rename from src/mc-templates/event-mini.php rename to src/mc-templates/event/mini.php diff --git a/src/mc-templates/event-next.php b/src/mc-templates/event/next.php similarity index 100% rename from src/mc-templates/event-next.php rename to src/mc-templates/event/next.php diff --git a/src/mc-templates/event-now.php b/src/mc-templates/event/now.php similarity index 100% rename from src/mc-templates/event-now.php rename to src/mc-templates/event/now.php diff --git a/src/mc-templates/event-single.php b/src/mc-templates/event/single.php similarity index 100% rename from src/mc-templates/event-single.php rename to src/mc-templates/event/single.php diff --git a/src/mc-templates/event-today.php b/src/mc-templates/event/today.php similarity index 100% rename from src/mc-templates/event-today.php rename to src/mc-templates/event/today.php diff --git a/src/mc-templates/event-upcoming.php b/src/mc-templates/event/upcoming.php similarity index 100% rename from src/mc-templates/event-upcoming.php rename to src/mc-templates/event/upcoming.php diff --git a/src/mc-templates/location-single.php b/src/mc-templates/location/location-single.php similarity index 100% rename from src/mc-templates/location-single.php rename to src/mc-templates/location/location-single.php diff --git a/src/my-calendar-output.php b/src/my-calendar-output.php index 64717e2df..48ac629d8 100644 --- a/src/my-calendar-output.php +++ b/src/my-calendar-output.php @@ -184,7 +184,7 @@ function mc_load_template( $type, $data, $source = 'event' ) { if ( ! $legacy_templates ) { // Check for nested template parts. if ( false !== strpos( $type, '/' ) ) { - $parts = explode( $type, '/' ); + $parts = explode( '/', $type ); $source = $parts[0]; $type = isset( $parts[1] ) ? $parts[1] : ''; } @@ -236,7 +236,7 @@ function my_calendar_draw_event( $event, $type, $process_date, $time, $template 'id' => $id, 'tags' => $tags, ); - $details = mc_load_template( $type, $data ); + $details = mc_load_template( 'event/' . $type, $data ); if ( ! $details ) { // assign empty values to template sections. diff --git a/src/my-calendar-widgets.php b/src/my-calendar-widgets.php index b3ad5c31a..85ceab5bf 100644 --- a/src/my-calendar-widgets.php +++ b/src/my-calendar-widgets.php @@ -578,7 +578,7 @@ function mc_produce_upcoming_events( $events, $template, $type = 'list', $order 'template' => $template, 'type' => $type, ); - $details = mc_load_template( 'upcoming', $data ); + $details = mc_load_template( 'event/upcoming', $data ); if ( ! $details ) { $html .= mc_format_upcoming_event( $out, $template, $type ); } @@ -777,7 +777,7 @@ function my_calendar_todays_events( $args ) { 'template' => $template, 'args' => $args, ); - $details = mc_load_template( 'today', $data ); + $details = mc_load_template( 'event/today', $data ); if ( $details ) { $todays_events[ $ts ][] = $details; } else {