Categories

有特色的模板

WordPress. 如何激活Twitter小部件(基于Twitter API 1 ?.1)

Ryan DeWitt 二零一三年四月十七日
Rating: 5.0/5. From 1 vote.
请稍等...

本教程展示了如何制作twitter widget 基于Twitter可行的 API 1.1.

WordPress. 如何激活Twitter小部件(基于Twitter API 1 ?.1)

1. Go to dev.twitter.com, open My Applications-> Create 你需要创建一个新的应用程序 app 使用此链接:
http://dev.twitter.com/apps/new

2. 填写表格并同意条款和规则.

3.In Details tab 你需要点击 创建访问权限 token. 您将需要消费者密钥、消费者秘密和访问 token, Access token 秘密是为了制造 widget workable.

4. 下载和安装 面向开发者的Twitter Feed plugin 使用以下连结: http://wordpress.org/extend/plugins/oauth-twitter-feed-for-developers

5. Open plugin settings in Settings –> Twitter Feed Auth.

6. 请填写表格. 你需要消费者密钥,消费者秘密,访问 token, Access token 秘密和推特的名字是为了制造 widget workable.

7. 您需要替换twitter中的代码 widget file. 文件位置取决于主题.

-如果你正在使用 regular WordPress主题将代码替换为 /我的twitter - themeXXXX /包含小部件widget.php 与下面的文件归档.

-如果你正在使用 Cherry framework theme: 替换代码 /我的twitter - cherryFramework /包含小部件widget.php 与下面的文件归档.

 'twitter',
  'description' => __('A widget that displays the latest tweets', CURRENT_THEME)
  );
  $this->WP_Widget( 'twitter-widget', __('Cherry - Twitter', CURRENT_THEME), $widget_ops );
  }   // Widget Settings
  
  function widget($args, $instance) {
  extract( $args );
  
  $title      = apply_filters('widget_title', $instance['title'] );
  $numb       = $instance['numb'];
  
  echo $before_widget;
  
  // Display the widget title
  if ( $title )
  echo $before_title . $title . $after_title;
  
  $opt_args = array(
  'trim_user'         => false,
  'exclude_replies'   => false,
  'include_rts'       => true
  );
  $tweets = getTweets(get_option('tdf_user_timeline'), $numb, $opt_args); 
  
  if ( is_array($tweets) ){
  
  // to use with intents
  echo "";
  }
  
  echo $after_widget;
  
  }   // display the widget
  
  function update($new_instance, $old_instance) {
  $instance = $old_instance;
  
  //Strip tags from title and name to remove HTML
  $instance['title']      = strip_tags( $new_instance['title'] );
  $instance['numb']       = strip_tags( $new_instance['numb'] );
  
  return $instance;
  }   // update the widget
  
  function form($instance) {
  //Set up some default widget settings.
  $defaults = array(
  'title' => __('Latest Tweets', CURRENT_THEME),
  'numb' => '3',
  'show_info' => true
  );
  $instance = wp_parse_args( (array) $instance, $defaults );
  
  // Widget Title: Text Input  ?>

或者,您可以使用此下载修改后的文件 link.

8. Change widget styles in style.css file to

/* Twitter插件*/
  .twitter {
位置:相对;
}
.twitter .tweet_list {
溢出:隐藏;
margin: 0;
}
.twitter .tweet_list > li {
边框:0 0 15px 0;
填充:0;
list-style-type:没有;
溢出:隐藏;
}
.twitter .tweet_list .时间戳{
位置:绝对的;
top: 0;
right: 0;
显示:块;
字体大小:11 px;
}
.twitter .tweet_list .时间戳a {
颜色:# 999;
}
.twitter .tweet_item {
border-bottom: 1px solid #E8E8E8;
最小高度:51 px;
填充:9px 12px;
位置:相对;
}
.twitter .tweet_content {
margin-left: 58 px;
}
.twitter .tweet_txt {
Padding: 0 0 5px 0;
}
.twitter .Tweet_txt a {
粗细:大胆的;
}
.twitter_intents {
text-align:正确;
浮:正确;
字体大小:11 px;
}
.Twitter_intents span {
显示:inline-block;
padding-left: 5 px;
}
.twitter .stream-item-header .账户组{
颜色:# 999;
}
.twitter .stream-item-header .avatar {
位置:绝对的;
top: 12px;
左:12 px;
}

9. Go to Appearance->Widgets. 找到Cherry-Twitter /我的twitter widget 并将其设置为适当的区域.

刷新您的网站. 如果所有操作都做得很好,Twitter帖子应该会显示出来.

请随时查看下面的详细视频教程:

WordPress. 如何激活Twitter小部件(基于Twitter API 1 ?.1)

Wordpress网站主题
这个条目被张贴了出来 WordPress教程 and tagged activate, API 1.1, twitter, widget, WordPress. 书签的 permalink.

提交罚单

如果您仍然无法找到关于您的问题的足够的教程,请使用以下链接向我们的技术支持团队提交请求. 我们将在接下来的24小时内为您提供我们的帮助和协助: 提交罚单