Build your own RSS FEED widget

Do you ever need (a quick way) to display posts on your sidebar?

You could probably find a plugin, but often you have little control over the output. Here is a quick way to use a single WordPress text widget to build your own sidebar feed widget. Unfortunately, you can only use feed URL’s from your own domain.

Code:

Instructions:

Step 1: Navigate to the Appearance > Widgets > admin page.

Step 2: Drag a new TEXT widget onto your sidebar or any widget area.

Step 3: Copy and paste all the code above into your widget.

Step 4: Change the following to your own domain:

var MyFeedURL = “http://wordpress.com/feed/”;

var MyFeedURL = “__your domain here__”;

Step 5:  Save the widget and then view a page where your sidebar displays. The widget can now be styled with CSS (you could add this above the script).

Screenshot:

widget

Notes:

  • Even your categories will have their own feed url, visit your category pages and add /feed/ to the end of the URL to get more control of your feeds.
  • View the XML feed URL directly and then experiment with the snippet to get even more control over the content that displays. The snippet refers to nodes in the xml file and uses those to display your content. I’ve left out the category, author and comment information in the example.

Demo:

View the sidebar on this page for an example “My Widget Title” >>>