Skip to content

Commit

Permalink
Remove "Day of Event" template
Browse files Browse the repository at this point in the history
  • Loading branch information
ryelle committed Jan 17, 2020
1 parent 4baf81d commit ac3e6c8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 90 deletions.
47 changes: 0 additions & 47 deletions public_html/wp-content/mu-plugins/theme-templates/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,9 @@

defined( 'WPINC' ) || die();

add_filter( 'theme_page_templates', __NAMESPACE__ . '\register_page_templates' );
add_filter( 'template_include', __NAMESPACE__ . '\set_page_template_locations' );
add_filter( 'template_include', __NAMESPACE__ . '\inject_offline_template', 20 ); // After others because being offline transcends other templates.
add_filter( 'wp_offline_error_precache_entry', __NAMESPACE__ . '\add_offline_template_cachebuster' );

/**
* Add new templates to the Page Template dropdown in the editor.
*
* @param array $templates
*
* @return array
*/
function register_page_templates( $templates ) {
/*
* Remove CampSite 2017's Day of template, since it's redundant, and having multiple templates in the menu
* would be confusing.
*/
if ( isset( $templates['templates/page-day-of.php'] ) ) {
unset( $templates['templates/page-day-of.php'] );
}

$templates['day-of-event'] = __( 'Day of Event', 'wordcamporg' );

natsort( $templates );
return $templates;
}

/**
* Tell WP where to load the templates from.
*
* @param string $template_path
*
* @return string
*/
function set_page_template_locations( $template_path ) {
global $post;

if ( ! $post instanceof WP_Post ) {
return $template_path;
}

switch ( $post->_wp_page_template ) {
case 'day-of-event':
$template_path = __DIR__ . '/templates/day-of-event.php';
break;
}

return $template_path;
}

/**
* Inject the offline template when the service worker pre-caches the response to offline requests.
*
Expand Down

This file was deleted.

0 comments on commit ac3e6c8

Please sign in to comment.