summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2020-01-06 14:32:30 -0500
committerAnthony G. Basile <blueness@gentoo.org>2020-01-06 14:32:30 -0500
commit10ef81bf85ad0a4bad0d204838e14c99ca2526f7 (patch)
treeb4bb36a326d41de12d1a6181d2a2baf34696ac24 /plugins/jetpack/modules/shortcodes/tweet.php
parentUpdating script for Update (diff)
downloadblogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.tar.gz
blogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.tar.bz2
blogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.zip
Update jetpack 8.0
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'plugins/jetpack/modules/shortcodes/tweet.php')
-rw-r--r--plugins/jetpack/modules/shortcodes/tweet.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/plugins/jetpack/modules/shortcodes/tweet.php b/plugins/jetpack/modules/shortcodes/tweet.php
index 5d6acd29..435195b6 100644
--- a/plugins/jetpack/modules/shortcodes/tweet.php
+++ b/plugins/jetpack/modules/shortcodes/tweet.php
@@ -204,12 +204,23 @@ class Jetpack_Tweet {
remove_filter( 'oembed_fetch_url', array( 'Jetpack_Tweet', 'jetpack_tweet_url_extra_args' ), 10 );
}
- // Add Twitter widgets.js script to the footer.
- add_action( 'wp_footer', array( 'Jetpack_Tweet', 'jetpack_tweet_shortcode_script' ) );
-
/** This action is documented in modules/widgets/social-media-icons.php */
do_action( 'jetpack_bump_stats_extras', 'embeds', 'tweet' );
+ if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
+ $width = ! empty( $attr['width'] ) ? $attr['width'] : 600;
+ $height = 480;
+ $output = sprintf(
+ '<amp-twitter data-tweetid="%1$s" layout="responsive" width="%2$d" height="%3$d"></amp-twitter>',
+ esc_attr( $tweet_id ),
+ absint( $width ),
+ absint( $height )
+ );
+ } else {
+ // Add Twitter widgets.js script to the footer.
+ add_action( 'wp_footer', array( 'Jetpack_Tweet', 'jetpack_tweet_shortcode_script' ) );
+ }
+
return $output;
}