diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2018-06-08 10:09:24 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2018-06-08 10:09:24 -0400 |
commit | a6b006c0f1ef757f23375f7906193370337d8bd7 (patch) | |
tree | 4467c6423b2c54e6ef8c3e79241a833fb17833a5 /plugins/jetpack/modules/theme-tools | |
parent | Update akismet 4.0.7 (diff) | |
download | blogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.tar.gz blogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.tar.bz2 blogs-gentoo-a6b006c0f1ef757f23375f7906193370337d8bd7.zip |
Update jetpack 6.2
Diffstat (limited to 'plugins/jetpack/modules/theme-tools')
7 files changed, 208 insertions, 13 deletions
diff --git a/plugins/jetpack/modules/theme-tools/compat/twentysixteen-rtl.css b/plugins/jetpack/modules/theme-tools/compat/twentysixteen-rtl.css index 8b0efbd3..a616269d 100644 --- a/plugins/jetpack/modules/theme-tools/compat/twentysixteen-rtl.css +++ b/plugins/jetpack/modules/theme-tools/compat/twentysixteen-rtl.css @@ -161,6 +161,72 @@ opacity: 0.8; } +/* Social Icons Widget */ +.widget.jetpack_widget_social_icons ul { + margin: 0 0 -0.4375em; +} + +.widget.jetpack_widget_social_icons ul:before, +.widget.jetpack_widget_social_icons ul:after { + content: ""; + display: table; +} + +.widget.jetpack_widget_social_icons ul:after { + clear: both; +} + +.widget.jetpack_widget_social_icons li { + float: right; + margin: 0 0 0.4375em 0.4375em; +} + +.widget.jetpack_widget_social_icons li a { + border: 1px solid currentColor; + border-radius: 50%; + color: inherit; + display: block; + position: relative; +} + +.widget.jetpack_widget_social_icons li a:hover, +.widget.jetpack_widget_social_icons li a:focus { + opacity: 0.8; +} + +.widget.jetpack_widget_social_icons ul.size-small a { + height: 38px; + padding: 6px; + width: 38px; +} + +.widget.jetpack_widget_social_icons ul.size-small svg { + height: 24px; + width: 24px; +} + +.widget.jetpack_widget_social_icons ul.size-medium a { + height: 50px; + padding: 8px; + width: 50px; +} + +.widget.jetpack_widget_social_icons ul.size-medium svg { + height: 32px; + width: 32px; +} + +.widget.jetpack_widget_social_icons ul.size-large a { + height: 70px; + padding: 10px; + width: 70px; +} + +.widget.jetpack_widget_social_icons ul.size-large svg { + height: 48px; + width: 48px; +} + /* Top Posts & Pages Widget */ .widget_top-posts .widgets-list-layout .widgets-list-layout-blavatar { margin-top: 0.25em; diff --git a/plugins/jetpack/modules/theme-tools/compat/twentysixteen.css b/plugins/jetpack/modules/theme-tools/compat/twentysixteen.css index 9495c9b3..672b264e 100644 --- a/plugins/jetpack/modules/theme-tools/compat/twentysixteen.css +++ b/plugins/jetpack/modules/theme-tools/compat/twentysixteen.css @@ -161,6 +161,72 @@ opacity: 0.8; } +/* Social Icons Widget */ +.widget.jetpack_widget_social_icons ul { + margin: 0 0 -0.4375em; +} + +.widget.jetpack_widget_social_icons ul:before, +.widget.jetpack_widget_social_icons ul:after { + content: ""; + display: table; +} + +.widget.jetpack_widget_social_icons ul:after { + clear: both; +} + +.widget.jetpack_widget_social_icons li { + float: left; + margin: 0 0.4375em 0.4375em 0; +} + +.widget.jetpack_widget_social_icons li a { + border: 1px solid currentColor; + border-radius: 50%; + color: inherit; + display: block; + position: relative; +} + +.widget.jetpack_widget_social_icons li a:hover, +.widget.jetpack_widget_social_icons li a:focus { + opacity: 0.8; +} + +.widget.jetpack_widget_social_icons ul.size-small a { + height: 38px; + padding: 6px; + width: 38px; +} + +.widget.jetpack_widget_social_icons ul.size-small svg { + height: 24px; + width: 24px; +} + +.widget.jetpack_widget_social_icons ul.size-medium a { + height: 50px; + padding: 8px; + width: 50px; +} + +.widget.jetpack_widget_social_icons ul.size-medium svg { + height: 32px; + width: 32px; +} + +.widget.jetpack_widget_social_icons ul.size-large a { + height: 70px; + padding: 10px; + width: 70px; +} + +.widget.jetpack_widget_social_icons ul.size-large svg { + height: 48px; + width: 48px; +} + /* Top Posts & Pages Widget */ .widget_top-posts .widgets-list-layout .widgets-list-layout-blavatar { margin-top: 0.25em; diff --git a/plugins/jetpack/modules/theme-tools/compat/twentysixteen.php b/plugins/jetpack/modules/theme-tools/compat/twentysixteen.php index 4f96c7c4..7e106037 100644 --- a/plugins/jetpack/modules/theme-tools/compat/twentysixteen.php +++ b/plugins/jetpack/modules/theme-tools/compat/twentysixteen.php @@ -49,3 +49,19 @@ function twentysixteen_remove_share() { } } add_action( 'loop_start', 'twentysixteen_remove_share' ); + +function twentysixteen_jetpack_lazy_images_compat() { + if ( ! function_exists( 'wp_add_inline_script' ) ) { + return; + } + + // Since TwentySixteen outdents when window is resized, let's trigger a window resize + // every time we lazy load an image on the TwentySixteen theme. + wp_add_inline_script( + 'jetpack-lazy-images', + "jQuery( document.body ).on( 'jetpack-lazy-loaded-image', function () { jQuery( window ).trigger( 'resize' ); } );" + ); +} + +// Priority needs to be 11 here so that we have already enqueued jetpack-lazy-images. +add_action( 'wp_enqueue_scripts', 'twentysixteen_jetpack_lazy_images_compat', 11 ); diff --git a/plugins/jetpack/modules/theme-tools/content-options/blog-display.php b/plugins/jetpack/modules/theme-tools/content-options/blog-display.php index 3b87c1d2..89665396 100644 --- a/plugins/jetpack/modules/theme-tools/content-options/blog-display.php +++ b/plugins/jetpack/modules/theme-tools/content-options/blog-display.php @@ -74,7 +74,7 @@ function jetpack_blog_display_custom_excerpt( $content ) { * Display Excerpt instead of Content. */ function jetpack_the_content_to_the_excerpt( $content ) { - if ( is_home() || is_archive() ) { + if ( ( is_home() || is_archive() ) && ! is_post_type_archive( array( 'jetpack-testimonial', 'jetpack-portfolio', 'product' ) ) ) { if ( post_password_required() ) { $content = sprintf( '<p>%s</p>', esc_html__( 'There is no excerpt because this is a protected post.', 'jetpack' ) ); } else { @@ -88,7 +88,7 @@ function jetpack_the_content_to_the_excerpt( $content ) { * Display Content instead of Excerpt. */ function jetpack_the_excerpt_to_the_content( $content ) { - if ( is_home() || is_archive() ) { + if ( ( is_home() || is_archive() ) && ! is_post_type_archive( array( 'jetpack-testimonial', 'jetpack-portfolio', 'product' ) ) ) { ob_start(); the_content( sprintf( wp_kses( @@ -112,7 +112,7 @@ function jetpack_the_excerpt_to_the_content( $content ) { */ function jetpack_the_content_customizer( $content ) { $class = jetpack_the_content_customizer_class(); - if ( is_home() || is_archive() ) { + if ( ( is_home() || is_archive() ) && ! is_post_type_archive( array( 'jetpack-testimonial', 'jetpack-portfolio', 'product' ) ) ) { if ( post_password_required() ) { $excerpt = sprintf( '<p>%s</p>', esc_html__( 'There is no excerpt because this is a protected post.', 'jetpack' ) ); } else { @@ -130,7 +130,7 @@ function jetpack_the_content_customizer( $content ) { * Display both Content and Excerpt instead of Excerpt in the Customizer so live preview can switch between them. */ function jetpack_the_excerpt_customizer( $excerpt ) { - if ( is_home() || is_archive() ) { + if ( ( is_home() || is_archive() ) && ! is_post_type_archive( array( 'jetpack-testimonial', 'jetpack-portfolio', 'product' ) ) ) { ob_start(); the_content( sprintf( wp_kses( @@ -157,7 +157,7 @@ function jetpack_the_excerpt_customizer( $excerpt ) { * Display Content instead of Excerpt in the Customizer when theme uses a 'Mixed' display. */ function jetpack_the_excerpt_mixed_customizer( $content ) { - if ( is_home() || is_archive() ) { + if ( ( is_home() || is_archive() ) && ! is_post_type_archive( array( 'jetpack-testimonial', 'jetpack-portfolio', 'product' ) ) ) { jetpack_the_content_customizer_class( 'output-the-excerpt' ); ob_start(); the_content(); diff --git a/plugins/jetpack/modules/theme-tools/content-options/featured-images.php b/plugins/jetpack/modules/theme-tools/content-options/featured-images.php index ce66a830..52ebe7fb 100644 --- a/plugins/jetpack/modules/theme-tools/content-options/featured-images.php +++ b/plugins/jetpack/modules/theme-tools/content-options/featured-images.php @@ -14,6 +14,7 @@ function jetpack_featured_images_remove_post_thumbnail( $metadata, $object_id, $ if ( ( true === $opts['archive'] && ( is_home() || is_archive() || is_search() ) + && ! jetpack_is_shop_page() && ! $opts['archive-option'] && ( isset( $meta_key ) && '_thumbnail_id' === $meta_key ) @@ -57,3 +58,27 @@ add_filter( 'get_post_metadata', 'jetpack_featured_images_remove_post_thumbnail' function jetpack_is_product() { return ( function_exists( 'is_product' ) ) ? is_product() : false; } + +/** + * Check if we are in a WooCommerce Shop in order to exclude it from the is_archive check. + */ +function jetpack_is_shop_page() { + // Check if WooCommerce is active first. + if ( ! class_exists( 'WooCommerce' ) ) { + return false; + } + + global $wp_query; + + $front_page_id = get_option( 'page_on_front' ); + $current_page_id = $wp_query->get( 'page_id' ); + $is_static_front_page = 'page' === get_option( 'show_on_front' ); + + if ( $is_static_front_page && $front_page_id === $current_page_id ) { + $is_shop_page = ( $current_page_id === wc_get_page_id( 'shop' ) ) ? true : false; + } else { + $is_shop_page = is_shop(); + } + + return $is_shop_page; +} diff --git a/plugins/jetpack/modules/theme-tools/featured-content.php b/plugins/jetpack/modules/theme-tools/featured-content.php index 07ad833b..d63f3fd5 100644 --- a/plugins/jetpack/modules/theme-tools/featured-content.php +++ b/plugins/jetpack/modules/theme-tools/featured-content.php @@ -114,6 +114,8 @@ class Featured_Content { add_action( 'switch_theme', array( __CLASS__, 'switch_theme' ) ); add_action( 'switch_theme', array( __CLASS__, 'delete_transient' ) ); add_action( 'wp_loaded', array( __CLASS__, 'wp_loaded' ) ); + add_action( 'update_option_featured-content', array( __CLASS__, 'flush_post_tag_cache' ), 10, 2 ); + add_action( 'delete_option_featured-content', array( __CLASS__, 'flush_post_tag_cache' ), 10, 2 ); add_action( 'split_shared_term', array( __CLASS__, 'jetpack_update_featured_content_for_split_terms', 10, 4 ) ); @@ -172,9 +174,9 @@ class Featured_Content { } $featured_posts = get_posts( array( - 'include' => $post_ids, - 'posts_per_page' => count( $post_ids ), - 'post_type' => self::$post_types, + 'include' => $post_ids, + 'posts_per_page' => count( $post_ids ), + 'post_type' => self::$post_types, 'suppress_filters' => false, ) ); @@ -268,6 +270,23 @@ class Featured_Content { } /** + * Flush the Post Tag relationships cache. + * + * Hooks in the "update_option_featured-content" action. + */ + public static function flush_post_tag_cache( $prev, $opts ) { + if ( ! empty( $opts ) && ! empty( $opts['tag-id'] ) ) { + $query = new WP_Query( array( + 'tag_id' => (int) $opts['tag-id'], + 'posts_per_page' => -1, + ) ); + foreach ( $query->posts as $post ) { + wp_cache_delete( $post->ID, 'post_tag_relationships' ); + } + } + } + + /** * Exclude featured posts from the blog query when the blog is the front-page, * and user has not checked the "Also display tagged posts outside the Featured Content area" checkbox. * @@ -644,7 +663,7 @@ class Featured_Content { Featured_Content::setup(); /** - * Adds the featured content plugin to the set of files for which action + * Adds the featured content plugin to the set of files for which action * handlers should be copied when the theme context is loaded by the REST API. * * @param array $copy_dirs Copy paths with actions to be copied diff --git a/plugins/jetpack/modules/theme-tools/responsive-videos.php b/plugins/jetpack/modules/theme-tools/responsive-videos.php index c7a5d72f..eb97130e 100644 --- a/plugins/jetpack/modules/theme-tools/responsive-videos.php +++ b/plugins/jetpack/modules/theme-tools/responsive-videos.php @@ -20,6 +20,9 @@ function jetpack_responsive_videos_init() { /* Wrap videos in Buddypress */ add_filter( 'bp_embed_oembed_html', 'jetpack_responsive_videos_embed_html' ); + + /* Wrap Slideshare shortcodes */ + add_filter( 'jetpack_slideshare_shortcode', 'jetpack_responsive_videos_embed_html' ); } add_action( 'after_setup_theme', 'jetpack_responsive_videos_init', 99 ); @@ -46,9 +49,9 @@ function jetpack_responsive_videos_embed_html( $html ) { } if ( defined( 'SCRIPT_DEBUG' ) && true == SCRIPT_DEBUG ) { - wp_enqueue_script( 'jetpack-responsive-videos-script', plugins_url( 'responsive-videos/responsive-videos.js', __FILE__ ), array( 'jquery' ), '1.2', true ); + wp_enqueue_script( 'jetpack-responsive-videos-script', plugins_url( 'responsive-videos/responsive-videos.js', __FILE__ ), array( 'jquery' ), '1.3', true ); } else { - wp_enqueue_script( 'jetpack-responsive-videos-min-script', plugins_url( 'responsive-videos/responsive-videos.min.js', __FILE__ ), array( 'jquery' ), '1.2', true ); + wp_enqueue_script( 'jetpack-responsive-videos-min-script', plugins_url( 'responsive-videos/responsive-videos.min.js', __FILE__ ), array( 'jquery' ), '1.3', true ); } // Enqueue CSS to ensure compatibility with all themes @@ -58,11 +61,11 @@ function jetpack_responsive_videos_embed_html( $html ) { } /** - * Check if oEmbed is a `$video_patterns` provider video before wrapping. + * Check if oEmbed is YouTube or Vimeo before wrapping. * * @return string */ -function jetpack_responsive_videos_maybe_wrap_oembed( $html, $url = null ) { +function jetpack_responsive_videos_maybe_wrap_oembed( $html, $url ) { if ( empty( $html ) || ! is_string( $html ) || ! $url ) { return $html; } |