Skip to content

Commit

Permalink
Update templates to use subdirectory structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
joedolson committed Oct 25, 2023
1 parent d2fa642 commit 2ff74c2
Show file tree
Hide file tree
Showing 13 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/includes/class-gamajo-template-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/my-calendar-output.php
Original file line number Diff line number Diff line change
Expand Up @@ -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] : '';
}
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/my-calendar-widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 2ff74c2

Please sign in to comment.