此函数的第二个参数(the_widget
) 是一个包含一些参数的数组,这些参数定义了小部件实例的变量,当您在侧栏“循环”之外时,您必须手动传递这些变量,而不是从数据库中获取它们。
我找到了GitHub Repo 对于此插件,参数位于链接中(AshleySheinwald/Simple-Twitter-Tweets/simple-twitter-tweets.php#L112-L138), 及以下内容:
<?php
//Set up some default widget settings.
$defaults = array(
\'title\' => __(\'Recent Tweets\', \'pi-tweet\')
, \'name\' => __(\'iPlanetUK\', \'pi-tweet\')
, \'numTweets\' => __(4, \'pi-tweet\') // How many to display
, \'cacheTime\' => __(5, \'pi-tweet\') // Time in minutes between updates
, \'consumerKey\' => __(\'xxxxxxxxxxxx\', \'pi-tweet\') // Consumer key
, \'consumerSecret\' => __(\'xxxxxxxxxxxx\', \'pi-tweet\') // Consumer secret
, \'accessToken\' => __(\'xxxxxxxxxxxx\', \'pi-tweet\') // Access token
, \'accessTokenSecret\' => __(\'xxxxxxxxxxxx\', \'pi-tweet\') // Access token secret
, \'exclude_replies\' => true
, \'twitterFollow\' => false
, \'dataShowCount\' => false
, \'dataShowScreenName\' => false
, \'dataLang\' => __(\'en\', \'pi-tweet\') // Language reference
// STARTING NEW FOR 2.0
// Time
, \'timeRef\' => false // false = use old full hour ref, true if selected will use hour ref as h (twitter style)
, \'timeAgo\' => true // true = show ago, false will turn it off
// Intents
, \'twitterIntents\' => false // true = Default: show Twitter Intents
, \'twitterIntentsText\' => false // false = Default: Show text - activate to turn off text display and use icons only
, \'intentColor\' => "#999999" // Default colour, light grey
// Avatar
, \'showAvatar\' => false // Show the avatar ?
, \'roundCorners\' => false // Do we want rounded corners
, \'avatarSize\' => "" // what size should it be - defaults to 48px
);
检查每个设置所需的值,然后小部件将正确打印。