| Server IP : 213.186.33.4 / Your IP : 216.73.216.146 Web Server : Apache System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : karinebmkh ( 644538) PHP Version : 8.4.22 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/karinebmkh/www2/wp-content/plugins/jetpack/modules/shortcodes/ |
Upload File : |
<?php
add_shortcode( 'twitter-timeline', 'twitter_timeline_shortcode' );
function twitter_timeline_shortcode( $atts ) {
$default_atts = array(
'username' => '',
'id' => '',
'width' => '450',
'height' => '282',
);
$atts = shortcode_atts( $default_atts, $atts, 'twitter-timeline' );
$atts['username'] = preg_replace( '/[^A-Za-z0-9_]+/', '', $atts['username'] );
if ( empty( $atts['username'] ) && ! is_numeric( $atts['id'] ) ) {
return '<!-- ' . __( 'Must specify Twitter Timeline id or username.', 'jetpack' ) . ' -->';
}
$output = '<a class="twitter-timeline"';
/** This filter is documented in modules/shortcodes/tweet.php */
$partner = apply_filters( 'jetpack_twitter_partner_id', 'jetpack' );
if ( ! empty( $partner ) ) {
$output .= ' data-partner="' . esc_attr( $partner ) . '"';
}
if ( is_numeric( $atts['width'] ) ) {
$output .= ' data-width="' . esc_attr( $atts['width'] ) . '"';
}
if ( is_numeric( $atts['height'] ) ) {
$output .= ' data-height="' . esc_attr( $atts['height'] ) . '"';
}
if ( is_numeric( $atts['id'] ) ) {
$output .= ' data-widget-id="' . esc_attr( $atts['id'] ) . '"';
}
if ( ! empty( $atts['username'] ) ) {
$output .= ' href="' . esc_url( 'https://twitter.com/' . $atts['username'] ) . '"';
}
$output .= '>';
$output .= sprintf( __( 'Tweets by @%s', 'jetpack' ), $atts['username'] );
$output .= '</a>';
wp_enqueue_script( 'jetpack-twitter-timeline' );
return $output;
}
function twitter_timeline_js() {
if ( is_customize_preview() ) {
wp_enqueue_script( 'jetpack-twitter-timeline' );
}
}
add_action( 'wp_enqueue_scripts', 'twitter_timeline_js' );