{"id":50548,"date":"2016-08-27T11:42:41","date_gmt":"2016-08-27T11:42:41","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/tweets-widget\/"},"modified":"2016-08-29T13:28:31","modified_gmt":"2016-08-29T13:28:31","slug":"tweets-widget","status":"publish","type":"plugin","link":"https:\/\/pan.wordpress.org\/plugins\/tweets-widget\/","author":15091598,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0","stable_tag":"1.0.1","tested":"4.5.33","requires":"3.5.1","requires_php":"","requires_plugins":"","header_name":"Tweets Widget","header_author":"fossasia","header_description":"","assets_banners_color":"","last_updated":"2016-08-29 13:28:31","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"http:\/\/wordpress.org\/extend\/plugins\/tweets-widget\/","header_author_uri":"http:\/\/fossasia.org\/","rating":5,"author_block_rating":0,"active_installs":20,"downloads":2600,"num_ratings":1,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"1"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0","1.0.1"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":"1484619","resolution":"1","location":"assets"},"screenshot-2.png":{"filename":"screenshot-2.png","revision":"1484619","resolution":"2","location":"assets"},"screenshot-3.png":{"filename":"screenshot-3.png","revision":"1484619","resolution":"3","location":"assets"}},"screenshots":{"1":"Tweets rendered via Loklak API","2":"Admin screen shows Loklak and Twitter API connect button and OAuth settings","3":"Widget screen shows feed options"},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[76432,76433,2061,2080,159],"plugin_category":[38,43,56],"plugin_contributors":[94502],"plugin_business_model":[],"class_list":["post-50548","plugin","type-plugin","status-publish","hentry","plugin_tags-loklak","plugin_tags-loklak-api","plugin_tags-oauth","plugin_tags-tweets","plugin_tags-twitter","plugin_category-authentication","plugin_category-customization","plugin_category-social-and-sharing","plugin_contributors-fossasia","plugin_committers-fossasia","plugin_committers-mariobehling","plugin_committers-sopankhosla"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/tweets-widget.svg","icon_2x":false,"generated":true},"screenshots":[{"src":"https:\/\/ps.w.org\/tweets-widget\/assets\/screenshot-1.png?rev=1484619","caption":"Tweets rendered via Loklak API"},{"src":"https:\/\/ps.w.org\/tweets-widget\/assets\/screenshot-2.png?rev=1484619","caption":"Admin screen shows Loklak and Twitter API connect button and OAuth settings"},{"src":"https:\/\/ps.w.org\/tweets-widget\/assets\/screenshot-3.png?rev=1484619","caption":"Widget screen shows feed options"}],"raw_content":"<!--section=description-->\n<p>Use anonymous Loklak API OR Connect your Twitter account to this plugin and the widget will display your latest tweets on your site.<\/p>\n\n<p>This plugin is compatible with the new <strong>Twitter API 1.1<\/strong> and provides full <strong>OAuth<\/strong> authentication via the Wordpress admin area.<\/p>\n\n<h3>Shortcodes<\/h3>\n\n<p>You can embed tweets in the body of your posts using a Wordpress the shortcode <code>[tweets]<\/code>.<\/p>\n\n<p>To specify a different user's timeline add the <code>user<\/code> attribute.<br \/>\nTo override the default number of 5 tweets add the <code>max<\/code> attribute, e.g:<\/p>\n\n<pre><code>[tweets max=10 user=KhoslaSopan]&lt;h3&gt;Theming&lt;\/h3&gt;\n<\/code><\/pre>\n\n<p>For starters you can alter some of the HTML using built-in WordPress features.<br \/>\nSee <a href=\"http:\/\/codex.wordpress.org\/Plugin_API\/Filter_Reference#Widgets\">Widget Filters<\/a>\nand <a href=\"http:\/\/codex.wordpress.org\/Widgetizing_Themes\">Widgetizing Themes<\/a><\/p>\n\n<p><strong>CSS<\/strong><\/p>\n\n<p>This plugin contains no default CSS. That's deliberate, so you can style it how you want.<\/p>\n\n<p>Tweets are rendered as a list which has various hooks you can use. Here's a rough template:<\/p>\n\n<pre><code>.tweets {\n    \/* style tweet list wrapper *\/\n}\n.tweets h3 {\n    \/* style whatever you did with the header *\/\n}\n.tweets ul { \n    \/* style tweet list*\/\n}\n.tweets li {\n   \/* style tweet item *\/\n}\n.tweets .tweet-text {\n   \/* style main tweet text *\/\n}\n.tweets .tweet-text a {\n   \/* style links, hashtags and mentions *\/\n}\n.tweets .tweet-text .emoji {\n  \/* style embedded emoji image in tweet *\/ \n}\n.tweets .tweet-details {\n  \/* style datetime and link under tweet *\/\n}\n<\/code><\/pre>\n\n<p><strong>Custom HTML<\/strong><\/p>\n\n<p>If you want to override the default markup of the tweets, the following filters are also available:<\/p>\n\n<ul>\n<li>Add a header between the widget title and the tweets with <code>tweets_render_before<\/code><\/li>\n<li>Perform your own rendering of the timestamp with <code>tweets_render_date<\/code><\/li>\n<li>Render plain tweet text to your own HTML with <code>tweets_render_text<\/code><\/li>\n<li>Render each composite tweet with <code>tweets_render_tweet<\/code><\/li>\n<li>Override the unordered list for tweets with <code>tweets_render_list<\/code> <\/li>\n<li>Add a footer before the end of the widget with <code>tweets_render_after<\/code><\/li>\n<\/ul>\n\n<p>Here's an <strong>example<\/strong> of using some of the above in your theme's functions.php file:<\/p>\n\n<pre><code>add_filter('tweets_render_date', function( $created_at ){\n    $date = DateTime::createFromFormat('D M d H:i:s O Y', $created_at );\n    return $date-&gt;format('d M h:ia');\n}, 10 , 1 );\n\nadd_filter('tweets_render_text', function( $text ){\n    return $text; \/\/ &lt;- will use default\n}, 10 , 1 );\n\nadd_filter('tweets_render_tweet', function( $html, $date, $link, array $tweet ){\n    $pic = $tweet['user']['profile_image_url_https'];\n    return '&lt;p class=\"my-tweet\"&gt;&lt;img src=\"'.$pic.'\"\/&gt;'.$html.'&lt;\/p&gt;&lt;p class=\"my-date\"&gt;&lt;a href=\"'.$link.'\"&gt;'.$date.'&lt;\/a&gt;&lt;\/p&gt;';\n}, 10, 4 );\n\nadd_filter('tweets_render_after', function(){\n    return '&lt;footer&gt;&lt;a href=\"https:\/\/twitter.com\/me\"&gt;More from me&lt;\/a&gt;&lt;\/footer&gt;';\n}, 10, 0 );&lt;h3&gt;Caching&lt;\/h3&gt;\n<\/code><\/pre>\n\n<p>Responses from the Twitter API are cached for 5 minutes by default. This means your new Tweets will not appear on your site in real time.<\/p>\n\n<p>This is deliberate not only for performance, but also to avoid Twitter's strict rate limits of 15 requests every 15 minutes.<\/p>\n\n<p>You can override the 300 second cache by using the <code>tweets_cache_seconds<\/code> filter in your theme as follows:<\/p>\n\n<p>This would extend the cache to 1 minute, which is the lowest value you should consider using on a live site:<\/p>\n\n<pre><code>add_filter('tweets_cache_seconds', function( $ttl ){\n    return 60;\n}, 10, 1 );\n<\/code><\/pre>\n\n<p>This would disable the cache (not recommended other than for debugging):<\/p>\n\n<pre><code>add_filter('tweets_cache_seconds', function( $ttl ){\n    return 0;\n}, 10, 1 );&lt;h3&gt;Emoji&lt;\/h3&gt;\n<\/code><\/pre>\n\n<p>If you want to disable Emoji image replacement, you can filter the replacement callback function to something empty, e.g:<\/p>\n\n<pre><code>add_filter('tweets_emoji_callback', function( $func ){\n    return '';\n} );\n<\/code><\/pre>\n\n<ul>\n<li><p>or to strip Emoji characters from all tweets, return your own replacement function that returns something else, e.g:<\/p>\n\n<p>add_filter('tweets_emoji_callback', function( $func ){\n    return function( array $match ){\n        return '<!-- removed emoji -->';\n    };\n} );<\/p>\n\n<h3>Credits<\/h3>\n\n<p>Screenshot taken with permission from http:\/\/stayingalivefoundation.org\/blog<\/p><\/li>\n<li><p>Portuguese translations by <a href=\"http:\/\/wordpress.org\/support\/profile\/leandrodimitrio\">Leandro Dimitrio<\/a><\/p><\/li>\n<li>German translations by <a href=\"https:\/\/twitter.com\/FlorianFelsing\">Florian Felsing<\/a> and <a href=\"http:\/\/wordpress.org\/support\/profile\/david_noh\">David Noh<\/a><\/li>\n<li>Russian translations by <a href=\"https:\/\/twitter.com\/YakovenkoAndrey\">Andrey Yakovenko<\/a><\/li>\n<li>Dutch translations by <a href=\"https:\/\/twitter.com\/dwichers\">Daniel Wichers<\/a><\/li>\n<li>Spanish translations by <a href=\"http:\/\/minimizo.com\">Pedro Pica<\/a><\/li>\n<\/ul>\n\n<h3>Notes<\/h3>\n\n<p>Be aware of <a href=\"https:\/\/dev.twitter.com\/terms\/display-requirements\">Twitter's display requirements<\/a> when rendering tweets on your website.<\/p>\n\n<p>Example code here uses PHP <a href=\"http:\/\/www.php.net\/manual\/en\/class.closure.php\">closures<\/a> which require PHP&gt;=5.3.0 and won't work on older systems.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Unzip all files to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Log into Wordpress admin and activate the 'Tweets' plugin through the 'Plugins' menu<\/li>\n<\/ol>\n\n<p>Once the plugin is installed and enabled you can use Loklak API or bind your plugin to a Twitter account as follows:<\/p>\n\n<p><strong>Use Loklak API<\/strong><\/p>\n\n<ol>\n<li>Tick the 'Loklak API' checkbox in API authentication settings.<\/li>\n<li>Click on 'Save settings'<\/li>\n<\/ol>\n\n<p>OR<\/p>\n\n<p><strong>Use Twitter 1.1 API<\/strong><\/p>\n\n<ol>\n<li>Register a Twitter application at https:\/\/dev.twitter.com\/apps<\/li>\n<li>Note the Consumer key and Consumer secret under OAuth settings<\/li>\n<li>Log into Wordpress admin and go to Settings &gt; Twitter API<\/li>\n<li>Enter the consumer key and secret and click 'Save settings'<\/li>\n<li>Click the 'Connect to Twitter' button and follow the prompts.<\/li>\n<\/ol>\n\n<p>Once your site is authenticated you can configure the widget as follows:<\/p>\n\n<ol>\n<li>Log into Wordpress admin and go to Appearance &gt; Widgets<\/li>\n<li>Drag 'Tweets' from 'Available widgets' to where you want it. e.g. Main Sidebar<\/li>\n<li>Optionally configure the widget title and number of tweets to display.<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt>How can I style the widget?<\/dt>\n<dd><p>See the 'Other Notes' tab for theming information.<\/p><\/dd>\n<dt>Do I have to register my own Twitter app?<\/dt>\n<dd><p>Yes, if you want to use Twitter's new API 1.1 . If you decide to use loklak.org's anonymous API then no need. More info in the 'Description' tab.<\/p><\/dd>\n<dt>How I do know what my Twitter OAuth settings are?<\/dt>\n<dd><p>These details are available in the <a href=\"https:\/\/dev.twitter.com\/apps\">Twitter dashboard<\/a><\/p><\/dd>\n<dt>What do I put in the third and fourth fields?<\/dt>\n<dd><p>Once you've populated the first two fields, just click the <em>Connect<\/em> button and follow the prompts.<\/p><\/dd>\n<dt>What is the \"Minimum popularity\" field?<\/dt>\n<dd><p>Here you can specify a number of retweets and favourites that a tweet must have before it's displayed.\nThis is useful for only showing your most interesting content.<\/p><\/dd>\n<dt>How can I prevent SSL certificate errors?<\/dt>\n<dd><p>If you're unable too fix your <a href=\"https:\/\/php.net\/manual\/en\/book.curl.php\">PHP cURL<\/a> installation, you can disable SSL verification of twitter.com by adding this to your theme functions.php:<br \/>\n    add_filter('https_ssl_verify', '__return_false');<br \/>\nBut, please do so at your own risk.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0.1<\/h4>\n\n<ul>\n<li>Fixes FAQs<\/li>\n<li>Fixes minor URL bugs<\/li>\n<\/ul>\n\n<h4>1.0<\/h4>\n\n<ul>\n<li>A whole new version!<\/li>\n<\/ul>","raw_excerpt":"Tweets Widget compatible with the new Twitter API 1.1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pan.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/50548","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pan.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/pan.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/pan.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=50548"}],"author":[{"embeddable":true,"href":"https:\/\/pan.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/fossasia"}],"wp:attachment":[{"href":"https:\/\/pan.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=50548"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/pan.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=50548"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/pan.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=50548"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/pan.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=50548"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/pan.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=50548"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/pan.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=50548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}