summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/theme-tools/compat')
-rw-r--r--plugins/jetpack/modules/theme-tools/compat/twentyfifteen.php2
-rw-r--r--plugins/jetpack/modules/theme-tools/compat/twentynineteen.php2
-rw-r--r--plugins/jetpack/modules/theme-tools/compat/twentyseventeen.php2
-rw-r--r--plugins/jetpack/modules/theme-tools/compat/twentysixteen.php2
-rw-r--r--plugins/jetpack/modules/theme-tools/compat/twentytwenty-rtl.css1
-rw-r--r--plugins/jetpack/modules/theme-tools/compat/twentytwenty.css232
-rw-r--r--plugins/jetpack/modules/theme-tools/compat/twentytwenty.php132
7 files changed, 369 insertions, 4 deletions
diff --git a/plugins/jetpack/modules/theme-tools/compat/twentyfifteen.php b/plugins/jetpack/modules/theme-tools/compat/twentyfifteen.php
index adaa42b7..b51149c6 100644
--- a/plugins/jetpack/modules/theme-tools/compat/twentyfifteen.php
+++ b/plugins/jetpack/modules/theme-tools/compat/twentyfifteen.php
@@ -1,7 +1,7 @@
<?php
/**
* Jetpack Compatibility File
- * See: http://jetpack.com/
+ * See: https://jetpack.com/
*/
function twentyfifteen_jetpack_setup() {
diff --git a/plugins/jetpack/modules/theme-tools/compat/twentynineteen.php b/plugins/jetpack/modules/theme-tools/compat/twentynineteen.php
index fcc8b8c1..12d9b74a 100644
--- a/plugins/jetpack/modules/theme-tools/compat/twentynineteen.php
+++ b/plugins/jetpack/modules/theme-tools/compat/twentynineteen.php
@@ -1,7 +1,7 @@
<?php
/**
* Jetpack Compatibility File
- * See: http://jetpack.com/
+ * See: https://jetpack.com/
*/
function twentynineteen_jetpack_setup() {
diff --git a/plugins/jetpack/modules/theme-tools/compat/twentyseventeen.php b/plugins/jetpack/modules/theme-tools/compat/twentyseventeen.php
index 4a60e504..284b54a4 100644
--- a/plugins/jetpack/modules/theme-tools/compat/twentyseventeen.php
+++ b/plugins/jetpack/modules/theme-tools/compat/twentyseventeen.php
@@ -1,7 +1,7 @@
<?php
/**
* Jetpack Compatibility File
- * See: http://jetpack.com/
+ * See: https://jetpack.com/
*/
function twentyseventeen_jetpack_setup() {
diff --git a/plugins/jetpack/modules/theme-tools/compat/twentysixteen.php b/plugins/jetpack/modules/theme-tools/compat/twentysixteen.php
index 816a74b5..439a3e95 100644
--- a/plugins/jetpack/modules/theme-tools/compat/twentysixteen.php
+++ b/plugins/jetpack/modules/theme-tools/compat/twentysixteen.php
@@ -1,7 +1,7 @@
<?php
/**
* Jetpack Compatibility File
- * See: http://jetpack.com/
+ * See: https://jetpack.com/
*/
function twentysixteen_jetpack_setup() {
diff --git a/plugins/jetpack/modules/theme-tools/compat/twentytwenty-rtl.css b/plugins/jetpack/modules/theme-tools/compat/twentytwenty-rtl.css
new file mode 100644
index 00000000..fc248ab3
--- /dev/null
+++ b/plugins/jetpack/modules/theme-tools/compat/twentytwenty-rtl.css
@@ -0,0 +1 @@
+.infinite-scroll .pagination-wrapper,.infinite-scroll.neverending #site-footer,.infinite-scroll.neverending .footer-nav-widgets-wrapper{display:none}.infinite-end.neverending .footer-nav-widgets-wrapper,.infinity-end.neverending #site-footer{display:block}.infinite-loader{margin:calc(3 * 1rem) auto}.infinite-loader .spinner{margin:0 auto;right:inherit!important}#site-content #infinite-handle{margin:0 auto;max-width:58rem;width:calc(100% - 8rem)}#site-content #infinite-handle span{background:100% 0;display:block;font-size:1.7rem;text-align:center}#site-content #infinite-handle span button,#site-content #infinite-handle span button:focus,#site-content #infinite-handle span button:hover{-webkit-appearance:none;-moz-appearance:none;border:none;background:#cd2653;border-radius:0;color:#fff;cursor:pointer;display:inline-block;font-size:1.5rem;font-weight:600;letter-spacing:.0333em;line-height:1.25;margin:0;opacity:1;padding:1.1em 1.44em;text-align:center;text-decoration:none;text-transform:uppercase;transition:opacity .15s linear}#site-content #infinite-handle span button:hover{text-decoration:underline}#site-content .infinite-wrap .hentry:first-of-type{padding:4rem 0 0}.entry-content #jp-relatedposts h3.jp-relatedposts-headline,.entry-content div.sharedaddy h3.sd-title,.entry-content h3.sd-title{font-size:2.8rem;font-weight:700;letter-spacing:-.016875em;line-height:1.5}@media (min-width:700px){.entry-content #jp-relatedposts h3.jp-relatedposts-headline,.entry-content div.sharedaddy h3.sd-title,.entry-content h3.sd-title{font-size:4rem}}.entry-content div.sharedaddy h3.sd-title:before,.entry-content h3.sd-title:before{border:0 none}.entry-content #jp-relatedposts h3.jp-relatedposts-headline em:before{border:0 none}.widget_authors ul{margin-right:0}.widget_authors li{margin-top:1rem;list-style:none}.widget_authors li:first-child{margin-top:2rem}.widget_eu_cookie_law_widget #eu-cookie-law,.widget_eu_cookie_law_widget #eu-cookie-law .accept{font-size:1.6rem;font-weight:500;padding:2rem}.widget_eu_cookie_law_widget #eu-cookie-law .accept{font-size:1.4rem;font-weight:600;letter-spacing:.0333em;line-height:1.25;padding:1.1em 1.44em;text-decoration:none;text-transform:uppercase;transition:opacity .15s linear}@media (max-width:600px){.widget_eu_cookie_law_widget #eu-cookie-law{font-size:1.4rem;padding:1.5rem 1.5rem 6.5rem}.widget_eu_cookie_law_widget #eu-cookie-law .accept{font-size:1.2rem;bottom:1.5rem;left:auto;right:1.5rem;padding:1rem;margin:0}}.entry-content #jp-relatedposts{max-width:120rem;margin:1em auto;width:calc(100% - 4rem)}@media (min-width:700px){.entry-content #jp-relatedposts{width:calc(100% - 8rem)}}#jp-relatedposts .jp-relatedposts-grid{display:flex;flex-grow:1;flex-basis:0;justify-content:space-between;box-sizing:border-box}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post,#jp-relatedposts .jp-relatedposts-post{width:calc(33% - 2rem);margin-right:0;margin-left:0}@media only screen and (max-width:640px){#jp-relatedposts .jp-relatedposts-grid{flex-direction:column}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post,#jp-relatedposts .jp-relatedposts-post{width:100%}}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post{padding-left:0}#jp-relatedposts#jp-relatedposts .jp-relatedposts-items p,#jp-relatedposts#jp-relatedposts .jp-relatedposts-items-visual h4.jp-relatedposts-post-title{font-size:inherit;line-height:1.5}#jp-relatedposts .jp-relatedposts-items-visual{margin-left:0}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post img.jp-relatedposts-post-img{width:100%}.entry-content .jetpack-recipe{margin:1em auto}.jp-related-posts-i2__post li{margin:0}.wp-block-jetpack-gif{margin:1em auto!important} \ No newline at end of file
diff --git a/plugins/jetpack/modules/theme-tools/compat/twentytwenty.css b/plugins/jetpack/modules/theme-tools/compat/twentytwenty.css
new file mode 100644
index 00000000..794c197e
--- /dev/null
+++ b/plugins/jetpack/modules/theme-tools/compat/twentytwenty.css
@@ -0,0 +1,232 @@
+/**
+ * Infinite scroll
+ */
+
+/* Globally hidden elements when Infinite Scroll is supported and in use. */
+.infinite-scroll .pagination-wrapper,
+.infinite-scroll.neverending .footer-nav-widgets-wrapper,
+.infinite-scroll.neverending #site-footer {
+ /* Theme Footer (when set to scrolling) */
+ display: none;
+}
+
+ /* When Infinite Scroll has reached its end we need to re-display elements that were hidden (via .neverending) before. */
+.infinite-end.neverending .footer-nav-widgets-wrapper,
+.infinity-end.neverending #site-footer {
+ display: block;
+}
+
+.infinite-loader {
+ margin: calc(3 * 1rem) auto;
+}
+
+.infinite-loader .spinner {
+ margin: 0 auto;
+ left: inherit !important;
+}
+
+#site-content #infinite-handle {
+ margin: 0 auto;
+ max-width: 58rem;
+ width: calc(100% - 8rem);
+}
+
+#site-content #infinite-handle span {
+ background: transparent;
+ display: block;
+ font-size: 1.7rem;
+ text-align: center;
+}
+
+#site-content #infinite-handle span button,
+#site-content #infinite-handle span button:hover,
+#site-content #infinite-handle span button:focus {
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ border: none;
+ background: #cd2653;
+ border-radius: 0;
+ color: #fff;
+ cursor: pointer;
+ display: inline-block;
+ font-size: 1.5rem;
+ font-weight: 600;
+ letter-spacing: 0.0333em;
+ line-height: 1.25;
+ margin: 0;
+ opacity: 1;
+ padding: 1.1em 1.44em;
+ text-align: center;
+ text-decoration: none;
+ text-transform: uppercase;
+ transition: opacity 0.15s linear;
+}
+
+#site-content #infinite-handle span button:hover {
+ text-decoration: underline;
+}
+
+#site-content .infinite-wrap .hentry:first-of-type {
+ padding: 4rem 0 0;
+}
+
+/**
+ * Sharing & Related Posts
+ */
+
+.entry-content div.sharedaddy h3.sd-title,
+.entry-content h3.sd-title,
+.entry-content #jp-relatedposts h3.jp-relatedposts-headline {
+ font-size: 2.8rem;
+ font-weight: 700;
+ letter-spacing: -0.016875em;
+ line-height: 1.5;
+}
+
+@media (min-width: 700px) {
+ .entry-content div.sharedaddy h3.sd-title,
+ .entry-content h3.sd-title,
+ .entry-content #jp-relatedposts h3.jp-relatedposts-headline {
+ font-size: 4rem;
+ }
+}
+
+.entry-content div.sharedaddy h3.sd-title:before,
+.entry-content h3.sd-title:before {
+ border: 0 none;
+}
+
+.entry-content #jp-relatedposts h3.jp-relatedposts-headline em:before {
+ border: 0 none;
+}
+
+/* Authors widget */
+.widget_authors ul {
+ margin-left: 0;
+}
+
+.widget_authors li {
+ margin-top: 1rem;
+ list-style: none;
+}
+
+.widget_authors li:first-child {
+ margin-top: 2rem;
+}
+
+/* EU cookie law */
+.widget_eu_cookie_law_widget #eu-cookie-law,
+.widget_eu_cookie_law_widget #eu-cookie-law .accept {
+ font-size: 1.6rem;
+ font-weight: 500;
+ padding: 2rem;
+}
+
+.widget_eu_cookie_law_widget #eu-cookie-law .accept {
+ font-size: 1.4rem;
+ font-weight: 600;
+ letter-spacing: 0.0333em;
+ line-height: 1.25;
+ padding: 1.1em 1.44em;
+ text-decoration: none;
+ text-transform: uppercase;
+ transition: opacity 0.15s linear;
+}
+
+@media (max-width: 600px) {
+ .widget_eu_cookie_law_widget #eu-cookie-law {
+ font-size: 1.4rem;
+ padding: 1.5rem 1.5rem 6.5rem;
+ }
+
+ .widget_eu_cookie_law_widget #eu-cookie-law .accept {
+ font-size: 1.2rem;
+ bottom: 1.5rem;
+ right: auto;
+ left: 1.5rem;
+ padding: 1rem;
+ margin: 0;
+ }
+}
+
+/* Related Posts */
+
+.entry-content #jp-relatedposts {
+ max-width: 120rem;
+ margin: 1em auto;
+ width: calc(100% - 4rem);
+}
+
+@media (min-width: 700px) {
+ .entry-content #jp-relatedposts {
+ width: calc(100% - 8rem);
+ }
+}
+
+#jp-relatedposts .jp-relatedposts-grid {
+ display: flex;
+ flex-grow: 1;
+ flex-basis: 0;
+ justify-content: space-between;
+ box-sizing: border-box;
+}
+
+#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post,
+#jp-relatedposts .jp-relatedposts-post {
+ width: calc(33% - 2rem);
+ margin-left: 0;
+ margin-right: 0;
+}
+
+@media only screen and (max-width: 640px) {
+ #jp-relatedposts .jp-relatedposts-grid {
+ flex-direction: column;
+ }
+
+ #jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post,
+ #jp-relatedposts .jp-relatedposts-post {
+ width: 100%;
+ }
+}
+
+#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post {
+ padding-right: 0;
+}
+
+#jp-relatedposts#jp-relatedposts .jp-relatedposts-items p,
+#jp-relatedposts#jp-relatedposts .jp-relatedposts-items-visual h4.jp-relatedposts-post-title {
+ font-size: inherit;
+ line-height: 1.5;
+}
+
+#jp-relatedposts .jp-relatedposts-items-visual {
+ margin-right: 0;
+}
+
+#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post img.jp-relatedposts-post-img {
+ width: 100%;
+}
+
+/**
+ * Shortcodes
+ */
+
+/* Recipe */
+.entry-content .jetpack-recipe {
+ margin: 1em auto;
+}
+
+/**
+ * Blocks
+ */
+
+/* Related Posts Block */
+.jp-related-posts-i2__post li {
+ margin: 0;
+}
+
+/* GIF Block */
+.wp-block-jetpack-gif {
+ /* !important because the gif block styles are loaded in the footer after this file */
+ margin: 1em auto !important;
+}
diff --git a/plugins/jetpack/modules/theme-tools/compat/twentytwenty.php b/plugins/jetpack/modules/theme-tools/compat/twentytwenty.php
new file mode 100644
index 00000000..f1620e08
--- /dev/null
+++ b/plugins/jetpack/modules/theme-tools/compat/twentytwenty.php
@@ -0,0 +1,132 @@
+<?php
+/**
+ * Jetpack Compatibility File
+ * See: https://jetpack.com/
+ *
+ * @package Jetpack
+ */
+
+/**
+ * Add Jetpack extra functionality to Twenty Twenty.
+ */
+function twentytwenty_jetpack_setup() {
+ /**
+ * Add theme support for Infinite Scroll.
+ */
+ add_theme_support(
+ 'infinite-scroll',
+ array(
+ 'type' => 'click',
+ 'container' => 'site-content',
+ 'render' => 'twentytwenty_infinite_scroll_render',
+ 'footer' => 'site-content',
+ )
+ );
+
+ /**
+ * Add theme support for geo-location.
+ */
+ add_theme_support( 'jetpack-geo-location' );
+}
+add_action( 'after_setup_theme', 'twentytwenty_jetpack_setup' );
+
+/**
+ * Custom render function for Infinite Scroll.
+ */
+function twentytwenty_infinite_scroll_render() {
+ while ( have_posts() ) {
+ echo '<hr class="post-separator styled-separator is-style-wide section-inner" aria-hidden="true" />';
+ the_post();
+ get_template_part( 'template-parts/content', get_post_type() );
+ }
+}
+
+/**
+ * Remove Sharing buttons and Likes from excerpts that are used as intro on single post views.
+ */
+function twentytwenty_no_sharing_on_excerpts() {
+ if ( is_single() ) {
+ // Remove sharing buttons.
+ remove_filter( 'the_excerpt', 'sharing_display', 19 );
+
+ // Remove Likes.
+ if ( class_exists( 'Jetpack_Likes' ) ) {
+ remove_filter( 'the_excerpt', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );
+ }
+ }
+}
+add_action( 'loop_start', 'twentytwenty_no_sharing_on_excerpts' );
+
+/**
+ * We do not need to display the Likes Heading here.
+ *
+ * @param string $heading Headline structure.
+ * @param string $title Title.
+ * @param string $module Module name.
+ */
+function twentytwenty_no_likes_heading( $heading, $title, $module ) {
+ if ( 'likes' === $module ) {
+ return '';
+ }
+
+ return $heading;
+}
+add_filter( 'jetpack_sharing_headline_html', 'twentytwenty_no_likes_heading', 10, 3 );
+
+/**
+ * Disable Ads in post excerpts, that are used as intro on single post views.
+ */
+add_filter( 'wordads_excerpt_disable', '__return_true' );
+
+/**
+ * Add our compat CSS file for Infinite Scroll and custom widget stylings and such.
+ * Set the version equal to filemtime for development builds, and the JETPACK__VERSION for production
+ * or skip it entirely for wpcom.
+ */
+function twentytwenty_enqueue_jetpack_style() {
+ $version = Jetpack::is_development_version()
+ ? filemtime( JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentytwenty.css' )
+ : JETPACK__VERSION;
+
+ wp_enqueue_style( 'twentytwenty-jetpack', plugins_url( 'twentytwenty.css', __FILE__ ), array(), $version );
+ wp_style_add_data( 'twentytwenty-jetpack', 'rtl', 'replace' );
+}
+add_action( 'wp_enqueue_scripts', 'twentytwenty_enqueue_jetpack_style' );
+
+/**
+ * Add inline custom CSS with custom accent color if there is any set.
+ */
+function twentytwenty_infinity_accent_color_css() {
+ // Bail early if no custom color was set.
+ if (
+ 'custom' !== get_theme_mod( 'accent_hue_active' )
+ || empty( get_theme_mod( 'accent_accessible_colors' ) )
+ ) {
+ return;
+ }
+
+ $color_info = get_theme_mod( 'accent_accessible_colors' );
+ $custom_css = sprintf(
+ '
+ .infinite-scroll #site-content #infinite-handle span button,
+ .infinite-scroll #site-content #infinite-handle span button:hover,
+ .infinite-scroll #site-content #infinite-handle span button:focus {
+ background: %1$s;
+ color: %2$s;
+ }
+ #site-content .entry-content div.sharedaddy h3.sd-title,
+ #site-content .entry-content h3.sd-title,
+ #site-content .entry-content #jp-relatedposts h3.jp-relatedposts-headline {
+ color: %3$s;
+ }
+ ',
+ $color_info['content']['accent'],
+ $color_info['content']['background'],
+ $color_info['content']['secondary']
+ );
+
+ // Add our custom style to the existing Twenty Twenty CSS compat file.
+ wp_add_inline_style( 'twentytwenty-jetpack', $custom_css );
+}
+add_action( 'wp_enqueue_scripts', 'twentytwenty_infinity_accent_color_css' );
+