PHPMatters Help You Better Hosting Your PHP-based Sites
How to Display Selective Tweets in WordPress

How to Display Selective Tweets in WordPress

Twitter is a powerful social networking platform with a large user base. With the great popularity, this platform has been used by plenty of webmasters to carry out the effective website promotion. Therefore, to tighten the relationship between Twitter and websites, many site owners choose to showcase a special Twitter widget in their homepages, from which the latest tweets will be displayed automatically.

However, it is possible that you may post some tweets that have no relevance to your website, such as your answers to some of the Twitter followers or the sharing of your daily events. In this case, you’d better do some configurations for your Twitter widget, only allowing it to display selective tweets in WordPress. Check the following steps on how to do this.

Step 1 – Create the Twitter Widget

If you have already showcased the latest Twitter tweets on your WordPress site, you can pass this step. Otherwise, you need to click this link for the creation of Twitter widget. Here, you can find a Create New button for your widget. Simply click it.

In the next page, you are required to determine some configurations for the creation of Twitter widget.

  • Enter the username of your website.
  • Decide whether to showcase the replies and whether to auto-expand the post photos.
  • Determine the height of the widget. The default setting is 600 pixels.
  • Choose the theme between Light and Dark based on your website design.
  • Decide the link color.

You can check the final effect from the widget preview section in the right side.

Create Widget

Step 2 – Determine Which Kind of Tweets Can Be Showcased

Now, you should use the Search Query function to determine the selective tweets that can be displayed in the widget. Here, you need to click the Search tab and enter your restrictions into the Search Query section.

For instance, if you only want to showcase the tweets that are showcased for your site, you can enter “from:sitename” into the box. Or, if you want to display the tweets that have your preferred keywords or hashtags, you can enter “#keyword”. You can decide these two factors in one time.

Search Query

Now, you can click the Create Widget button. Once the process is finished, Twitter will generate the exclusive lines of coding stuff for your widget. Just copy and save the codes.

Step 3 – Showcase the Selective Tweets in Your Website Sidebar

Now, you should log into your WordPress administrative panel and click the Widget button from the Appearance tab. Here, you can find a default text widget for adding HTML and the arbitrary texts. Simply drag and drop it to your preferred location of the sidebar.

Next, you simply need to enter the codes you have saved previously into the content section and give this widget a name. After clicking the Save button, you can showcase your selective tweets properly.

Text Widget