summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/shortcodes/twitter-timeline.php')
-rw-r--r--plugins/jetpack/modules/shortcodes/twitter-timeline.php24
1 files changed, 22 insertions, 2 deletions
diff --git a/plugins/jetpack/modules/shortcodes/twitter-timeline.php b/plugins/jetpack/modules/shortcodes/twitter-timeline.php
index 38558b49..f282943d 100644
--- a/plugins/jetpack/modules/shortcodes/twitter-timeline.php
+++ b/plugins/jetpack/modules/shortcodes/twitter-timeline.php
@@ -1,6 +1,18 @@
<?php
-add_shortcode( 'twitter-timeline', 'twitter_timeline_shortcode' );
+/**
+ * Twitter Timeline Shortcode.
+ *
+ * Examples:
+ * [twitter-timeline username=jetpack]
+ *
+ * @package Jetpack
+ */
+/**
+ * Render the Twitter shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ */
function twitter_timeline_shortcode( $atts ) {
$default_atts = array(
'username' => '',
@@ -39,7 +51,11 @@ function twitter_timeline_shortcode( $atts ) {
$output .= '>';
- $output .= sprintf( __( 'Tweets by @%s', 'jetpack' ), $atts['username'] );
+ $output .= sprintf(
+ /* Translators: placeholder is a Twitter username. */
+ __( 'Tweets by @%s', 'jetpack' ),
+ $atts['username']
+ );
$output .= '</a>';
@@ -47,7 +63,11 @@ function twitter_timeline_shortcode( $atts ) {
return $output;
}
+add_shortcode( 'twitter-timeline', 'twitter_timeline_shortcode' );
+/**
+ * Enqueue the js used by the Twitter shortcode.
+ */
function twitter_timeline_js() {
if ( is_customize_preview() ) {
wp_enqueue_script( 'jetpack-twitter-timeline' );