From 00cd6d4e3097f7b8b4c3fd472eea5e3e573da21d Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Fri, 10 Jan 2020 16:05:14 -0500 Subject: [PATCH 1/5] Theme Templates: Add `wrap` div to correct alignment of pages on Twenty Seventeen --- .../templates/day-of-event.php | 46 ++++++++++--------- .../theme-templates/templates/offline.php | 4 ++ 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/public_html/wp-content/mu-plugins/theme-templates/templates/day-of-event.php b/public_html/wp-content/mu-plugins/theme-templates/templates/day-of-event.php index 196174600..e140d08ab 100644 --- a/public_html/wp-content/mu-plugins/theme-templates/templates/day-of-event.php +++ b/public_html/wp-content/mu-plugins/theme-templates/templates/day-of-event.php @@ -12,27 +12,31 @@ get_header(); ?> -
- -
> -
- ', '' ); ?> -
- -
- -
-
- - -
+' : ''; ?> + +
+ +
> +
+ ', '' ); ?> +
+ +
+ +
+
+ + +
+ +' : ''; ?> +' : ''; ?> +
+' : ''; ?> + Date: Fri, 10 Jan 2020 16:07:26 -0500 Subject: [PATCH 2/5] Theme Templates: Add Twenty Twenty specific template for offline views Twenty Twenty uses a much different markup format for pages, so it's easier to match by using an entirely separate template. This approach should be considered a "patch", if the PWA merges into core, default themes will provide these templates. --- .../mu-plugins/theme-templates/bootstrap.php | 6 ++- .../templates/offline-2020.php | 46 +++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 public_html/wp-content/mu-plugins/theme-templates/templates/offline-2020.php diff --git a/public_html/wp-content/mu-plugins/theme-templates/bootstrap.php b/public_html/wp-content/mu-plugins/theme-templates/bootstrap.php index 1a581638e..274bb2cde 100644 --- a/public_html/wp-content/mu-plugins/theme-templates/bootstrap.php +++ b/public_html/wp-content/mu-plugins/theme-templates/bootstrap.php @@ -71,7 +71,11 @@ function set_page_template_locations( $template_path ) { */ function inject_offline_template( $template_path ) { if ( function_exists( 'is_offline' ) && ( \is_offline() || \is_500() ) ) { - $template_path = __DIR__ . '/templates/offline.php'; + if ( 'twentytwenty' === get_template() ) { + $template_path = __DIR__ . '/templates/offline-2020.php'; + } else { + $template_path = __DIR__ . '/templates/offline.php'; + } } return $template_path; diff --git a/public_html/wp-content/mu-plugins/theme-templates/templates/offline-2020.php b/public_html/wp-content/mu-plugins/theme-templates/templates/offline-2020.php new file mode 100644 index 000000000..b46b5f7b2 --- /dev/null +++ b/public_html/wp-content/mu-plugins/theme-templates/templates/offline-2020.php @@ -0,0 +1,46 @@ + + +
+ +
id="post-"> + +
+ +
+ +

+ +
+ +
+ +
+ +
+ + + +
+ +
+ +
+ +
+ + + + From 4baf81dba6175c4032577661b5dc937983d614a6 Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Fri, 17 Jan 2020 10:08:13 -0500 Subject: [PATCH 3/5] Remove template assignment from "Day of Event" stub --- .../plugins/wcpt/wcpt-wordcamp/wordcamp-new-site.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-new-site.php b/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-new-site.php index 7db1f334f..8bae9a710 100644 --- a/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-new-site.php +++ b/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-new-site.php @@ -621,9 +621,6 @@ protected function get_stub_pages( $wordcamp, $meta ) { 'content' => $this->get_stub_content( 'page', 'day-of-event', $wordcamp ), 'status' => 'draft', 'type' => 'page', - 'meta' => array( - '_wp_page_template' => 'day-of-event', // Set the page template. - ), ), ); From ac3e6c8a612ebb47741f6ba353b626467118b80b Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Fri, 17 Jan 2020 10:09:34 -0500 Subject: [PATCH 4/5] Remove "Day of Event" template --- .../mu-plugins/theme-templates/bootstrap.php | 47 ------------------- .../templates/day-of-event.php | 43 ----------------- 2 files changed, 90 deletions(-) delete mode 100644 public_html/wp-content/mu-plugins/theme-templates/templates/day-of-event.php diff --git a/public_html/wp-content/mu-plugins/theme-templates/bootstrap.php b/public_html/wp-content/mu-plugins/theme-templates/bootstrap.php index 274bb2cde..295882629 100644 --- a/public_html/wp-content/mu-plugins/theme-templates/bootstrap.php +++ b/public_html/wp-content/mu-plugins/theme-templates/bootstrap.php @@ -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. * diff --git a/public_html/wp-content/mu-plugins/theme-templates/templates/day-of-event.php b/public_html/wp-content/mu-plugins/theme-templates/templates/day-of-event.php deleted file mode 100644 index e140d08ab..000000000 --- a/public_html/wp-content/mu-plugins/theme-templates/templates/day-of-event.php +++ /dev/null @@ -1,43 +0,0 @@ - - -' : ''; ?> - -
- -
> -
- ', '' ); ?> -
- -
- -
-
- - -
- -' : ''; ?> - - Date: Fri, 17 Jan 2020 13:53:03 -0500 Subject: [PATCH 5/5] Drastically simplify the Offline page --- .../mu-plugins/theme-templates/bootstrap.php | 6 +- .../templates/offline-2020.php | 46 ----------- .../theme-templates/templates/offline.php | 77 ++++++++++++++----- 3 files changed, 59 insertions(+), 70 deletions(-) delete mode 100644 public_html/wp-content/mu-plugins/theme-templates/templates/offline-2020.php diff --git a/public_html/wp-content/mu-plugins/theme-templates/bootstrap.php b/public_html/wp-content/mu-plugins/theme-templates/bootstrap.php index 295882629..acd131d60 100644 --- a/public_html/wp-content/mu-plugins/theme-templates/bootstrap.php +++ b/public_html/wp-content/mu-plugins/theme-templates/bootstrap.php @@ -24,11 +24,7 @@ */ function inject_offline_template( $template_path ) { if ( function_exists( 'is_offline' ) && ( \is_offline() || \is_500() ) ) { - if ( 'twentytwenty' === get_template() ) { - $template_path = __DIR__ . '/templates/offline-2020.php'; - } else { - $template_path = __DIR__ . '/templates/offline.php'; - } + $template_path = __DIR__ . '/templates/offline.php'; } return $template_path; diff --git a/public_html/wp-content/mu-plugins/theme-templates/templates/offline-2020.php b/public_html/wp-content/mu-plugins/theme-templates/templates/offline-2020.php deleted file mode 100644 index b46b5f7b2..000000000 --- a/public_html/wp-content/mu-plugins/theme-templates/templates/offline-2020.php +++ /dev/null @@ -1,46 +0,0 @@ - - -
- -
id="post-"> - -
- -
- -

- -
- -
- -
- -
- - - -
- -
- -
- -
- - - - diff --git a/public_html/wp-content/mu-plugins/theme-templates/templates/offline.php b/public_html/wp-content/mu-plugins/theme-templates/templates/offline.php index fb1638422..5299c9fb7 100644 --- a/public_html/wp-content/mu-plugins/theme-templates/templates/offline.php +++ b/public_html/wp-content/mu-plugins/theme-templates/templates/offline.php @@ -15,29 +15,68 @@ namespace WordCamp\Theme_Templates; -get_header(); - $offline_page = get_offline_content(); -?> +$site_description = get_bloginfo( 'description' ); +?> -' : ''; ?> +> -
-
- + -
- -
-
-
+ + -' : ''; ?> + - + + + + +> +
+
+

+ +

+ +

+ +
+
+
+
+

+ +

+
-get_footer(); +
+ +
+
+
+
+ + +