Small Improvements
-
Hi @abuhayat!
Thanks for that little sweet plugin ??
I added some options and want to share it:
- lang (short language code e.g. en|de|ja)
- chrome (noheader nofooter noborders noscrollbar transparent)
- limit (limits the number of tweets [1-20])
- optout (true = do not track)
and I also added rel=”nofollow” to the a href element.
// Shortcode for Timeline function etf_shortcode_func($atts){ extract( shortcode_atts( array( 'username' => null, 'width' => null, 'height' => null, 'theme' => 'dark', 'title' => null, 'lang' => 'de', 'chrome' => null, 'limit' => null, 'optout' => null, ), $atts ) ); ?> <?php ob_start();?> <?php if (!empty($username)){ ?> <a class="twitter-timeline" data-theme="<?php echo $theme; ?>" href="https://twitter.com/<?php echo $username; ?>" data-tweet-limit="<?php echo $tweet-limit; ?>" data-chrome="<?php echo $chrome; ?>" data-lang="<?php echo $lang; ?>" data-dnt="<?php echo $optout; ?>" rel="nofollow"><?php echo $title; ?> <?php echo $username; ?></a> <?php }else{ echo '<h2>You must enter your Twitter handle in the username attribute of the shortcode. </h2>';} $output = ob_get_clean();return $output; } add_shortcode('timeline','etf_shortcode_func');
- The topic ‘Small Improvements’ is closed to new replies.