summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/theme-tools/compat/twentynineteen.php')
-rw-r--r--plugins/jetpack/modules/theme-tools/compat/twentynineteen.php81
1 files changed, 49 insertions, 32 deletions
diff --git a/plugins/jetpack/modules/theme-tools/compat/twentynineteen.php b/plugins/jetpack/modules/theme-tools/compat/twentynineteen.php
index 23692325..c7afd055 100644
--- a/plugins/jetpack/modules/theme-tools/compat/twentynineteen.php
+++ b/plugins/jetpack/modules/theme-tools/compat/twentynineteen.php
@@ -2,21 +2,29 @@
/**
* Jetpack Compatibility File
* See: https://jetpack.com/
+ *
+ * @package automattic/jetpack
*/
+/**
+ * Add Jetpack theme supports for Twenty Nineteen.
+ */
function twentynineteen_jetpack_setup() {
/**
- * Add theme support for Infinite Scroll.
+ * Add theme support for Infinite Scroll.
*/
- add_theme_support( 'infinite-scroll', array(
- 'type' => 'click',
- 'container' => 'main',
- 'render' => 'twentynineteen_infinite_scroll_render',
- 'footer' => 'page',
- ) );
-
- /**
+ add_theme_support(
+ 'infinite-scroll',
+ array(
+ 'type' => 'click',
+ 'container' => 'main',
+ 'render' => 'twentynineteen_infinite_scroll_render',
+ 'footer' => 'page',
+ )
+ );
+
+ /**
* Add theme support for Responsive Videos.
*/
add_theme_support( 'jetpack-responsive-videos' );
@@ -29,22 +37,25 @@ function twentynineteen_jetpack_setup() {
/**
* Add theme support for Content Options.
*/
- add_theme_support( 'jetpack-content-options', array(
- 'blog-display' => array( 'content', 'excerpt' ),
- 'post-details' => array(
- 'stylesheet' => 'twentynineteen-style',
- 'date' => '.posted-on',
- 'categories' => '.cat-links',
- 'tags' => '.tags-links',
- 'author' => '.byline',
- 'comment' => '.comments-link',
- ),
- 'featured-images' => array(
- 'archive' => true,
- 'post' => true,
- 'page' => true,
- ),
- ) );
+ add_theme_support(
+ 'jetpack-content-options',
+ array(
+ 'blog-display' => array( 'content', 'excerpt' ),
+ 'post-details' => array(
+ 'stylesheet' => 'twentynineteen-style',
+ 'date' => '.posted-on',
+ 'categories' => '.cat-links',
+ 'tags' => '.tags-links',
+ 'author' => '.byline',
+ 'comment' => '.comments-link',
+ ),
+ 'featured-images' => array(
+ 'archive' => true,
+ 'post' => true,
+ 'page' => true,
+ ),
+ )
+ );
}
add_action( 'after_setup_theme', 'twentynineteen_jetpack_setup' );
@@ -58,6 +69,9 @@ function twentynineteen_infinite_scroll_render() {
}
}
+/**
+ * Enqueue Jetpack compat styles for Twenty Nineteen.
+ */
function twentynineteen_init_jetpack() {
/**
* Add our compat CSS file for Infinite Scroll and custom widget stylings and such.
@@ -78,7 +92,7 @@ add_action( 'init', 'twentynineteen_init_jetpack' );
/**
* Alter gallery widget default width.
*/
-function twentynineteen_gallery_widget_content_width( $width ) {
+function twentynineteen_gallery_widget_content_width() {
return 390;
}
add_filter( 'gallery_widget_content_width', 'twentynineteen_gallery_widget_content_width' );
@@ -86,7 +100,7 @@ add_filter( 'gallery_widget_content_width', 'twentynineteen_gallery_widget_conte
/**
* Alter featured-image default visibility for content-options.
*/
-function twentynineteen_override_post_thumbnail( $width ) {
+function twentynineteen_override_post_thumbnail() {
$options = get_theme_support( 'jetpack-content-options' );
$featured_images = ( ! empty( $options[0]['featured-images'] ) ) ? $options[0]['featured-images'] : null;
@@ -95,10 +109,13 @@ function twentynineteen_override_post_thumbnail( $width ) {
'page-default' => ( isset( $featured_images['page-default'] ) && false === $featured_images['page-default'] ) ? '' : 1,
);
- $settings = array_merge( $settings, array(
- 'post-option' => get_option( 'jetpack_content_featured_images_post', $settings['post-default'] ),
- 'page-option' => get_option( 'jetpack_content_featured_images_page', $settings['page-default'] ),
- ) );
+ $settings = array_merge(
+ $settings,
+ array(
+ 'post-option' => get_option( 'jetpack_content_featured_images_post', $settings['post-default'] ),
+ 'page-option' => get_option( 'jetpack_content_featured_images_page', $settings['page-default'] ),
+ )
+ );
if ( ( ! $settings['post-option'] && is_single() )
|| ( ! $settings['page-option'] && is_singular() && is_page() ) ) {
@@ -116,7 +133,7 @@ add_filter( 'twentynineteen_can_show_post_thumbnail', 'twentynineteen_override_p
* @return array
*/
function twentynineteen_jetpack_body_classes( $classes ) {
- // Adds a class if we're in the Customizer
+ // Adds a class if we're in the Customizer.
if ( is_customize_preview() ) :
$classes[] = 'twentynineteen-customizer';
endif;