baardbaard / bb-twitterfeed
最小化的WordPress Twitterfeed插件。
0.5
2017-01-11 23:09 UTC
Requires
- php: >=5.4
- baardbaard/urllinker: 0.1
- mustache/mustache: ^2.11
Requires (Dev)
- phpdocumentor/phpdocumentor: ^2.8
- phpunit/phpunit: 5.5.*
- raveren/kint: ^1.0
This package is not auto-updated.
Last update: 2024-09-28 18:42:15 UTC
README
Twitterfeed是一个WordPress插件,它提供了一个无样式的Twitter流。
它使用Twitter-API-1.1-Client-for-Wordpress连接到Twitter API,并使用kwi-urllinker在推文中查找URL并将它们转换为链接。它使用Mustache来渲染模板。
- 通过运行
composer require baardbaard/bb-twitterfeed
使用Composer安装此插件,或将它添加到项目的composer.json
中,如下所示
确保在项目的某处引入由Composer生成的{ "require": { "baardbaard/bb-twitterfeed": "0.5" } }
autoload.php
。在wp-config.php
中是一个不错的选择。您还可以下载此插件,并在插件文件夹的根目录下运行composer install
。 - 在https://dev.twitter.com/apps创建Twitter应用并获取凭证。
- 在WordPress仪表板上输入您的Twitter密钥和密钥:设置 > Twitterfeed。
- 添加并激活插件,并在模板中使用以下代码
<?php
$twitterfeed->create_feed( array(
'user' => 'baardbaard',
'number_of_tweets' => 5, // optional
'profile_image_size' => 'mini|normal|bigger|original', // optional, normal = default
) );
?>
或者您也可以使用短代码
// Add this to your page/post/widget in your WYSIWYG editor.
[twitterfeed user="baardbaard" number_of_tweets="3" profile_image_size="bigger"]
// Or use this in your template files.
echo do_shortcode( '[twitterfeed user="baardbaard" number_of_tweets="3" profile_image_size="bigger"]' );
输出看起来像这样
<ul class="tweets">
<li class="tweet">
<a href="https://www.twitter.com/baardbaard" class="tweet__user-photo"><img src="https://pbs.twimg.com/profile_images/545552771378712577/gST9ZRmm_normal.jpeg"></a>
<a href="https://www.twitter.com/baardbaard" class="tweet__user">Stef Thoen</a>
<span class="tweet__content">“Don’t let your dreams be dreams. Yesterday, you said tomorrow.”</span>
<span class="tweet__time">about 4 days ago</span>
</li>
</ul><!-- /.tweets -->
路线图
0.6
- 使用自定义类替换CSS类
- 使用缓存来保存推文
- 重写以使用PSR-2