Skip to content

Commit

Permalink
Twenty Twenty: Update Jetpack compatibility (#14175)
Browse files Browse the repository at this point in the history
* Twenty Twenty: Update Jetpack compatibility

* Fix PHPCS warnings

* Revert to click as the default Infinite Scroll behaviour


Co-authored-by: Jeremy Herve <jeremy@jeremy.hu>
  • Loading branch information
danieldudzic and jeherve committed Dec 6, 2019
1 parent 895d459 commit 2043615
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 7 deletions.
18 changes: 16 additions & 2 deletions modules/theme-tools/compat/twentytwenty.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
* Infinite scroll
*/

#infinite-footer {
z-index: 1;
}

/* Globally hidden elements when Infinite Scroll is supported and in use. */
.infinite-scroll .pagination-wrapper,
.infinite-scroll.neverending .footer-nav-widgets-wrapper,
Expand All @@ -16,8 +20,12 @@
display: block;
}

.infinity-end.neverending #site-footer {
margin: 8rem 0 0;
}

.infinite-loader {
margin: calc(3 * 1rem) auto;
margin: 5rem auto;
}

.infinite-loader .spinner {
Expand All @@ -26,7 +34,7 @@
}

#site-content #infinite-handle {
margin: 0 auto;
margin: 5rem auto;
max-width: 58rem;
width: calc(100% - 8rem);
}
Expand Down Expand Up @@ -102,6 +110,7 @@

/* Authors widget */
.widget_authors ul {
list-style: none;
margin-left: 0;
}

Expand All @@ -114,6 +123,11 @@
margin-top: 2rem;
}

/* Flickr */
.widget_flickr .flickr-size-thumbnail .flickr-images {
justify-content: left;
}

/* EU cookie law */
.widget_eu_cookie_law_widget #eu-cookie-law,
.widget_eu_cookie_law_widget #eu-cookie-law .accept {
Expand Down
40 changes: 35 additions & 5 deletions modules/theme-tools/compat/twentytwenty.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

/**
* Add Jetpack extra functionality to Twenty Twenty.
*
* See: https://jetpack.com/support/infinite-scroll/
* See: https://jetpack.com/support/responsive-videos/
* See: https://jetpack.com/support/content-options/
*/
function twentytwenty_jetpack_setup() {
/**
Expand All @@ -16,13 +20,40 @@ function twentytwenty_jetpack_setup() {
add_theme_support(
'infinite-scroll',
array(
'type' => 'click',
'container' => 'site-content',
'render' => 'twentytwenty_infinite_scroll_render',
'footer' => 'site-content',
'type' => 'click',
'container' => 'site-content',
'render' => 'twentytwenty_infinite_scroll_render',
'footer' => 'site-content',
'footer_widgets' => array(
'sidebar-1',
'sidebar-2',
),
)
);

// Add theme support for Content Options.
add_theme_support(
'jetpack-content-options',
array(
'post-details' => array(
'stylesheet' => 'twentytwenty-style',
'date' => '.post-date',
'categories' => '.entry-categories',
'tags' => '.post-tags',
'author' => '.post-author',
),
'featured-images' => array(
'archive' => true,
'post' => true,
'page' => true,
'fallback' => false,
),
)
);

// Social Menu.
add_theme_support( 'jetpack-social-menu', 'svg' );

/**
* Add theme support for geo-location.
*/
Expand Down Expand Up @@ -129,4 +160,3 @@ function twentytwenty_infinity_accent_color_css() {
wp_add_inline_style( 'twentytwenty-jetpack', $custom_css );
}
add_action( 'wp_enqueue_scripts', 'twentytwenty_infinity_accent_color_css' );

0 comments on commit 2043615

Please sign in to comment.