KB Plugins

The best Wordpress plugins are free

Print this post

New and improved: KB Advanced RSS v 2.0

I uploaded a new, rewritten version of the KB Advanced RSS widget to the wordpress plugins repository today. Features:

  • New options for trimming and formatting elements
  • Better handling of the pubdate field
  • Easier to customize with your own code

Download it here

Check out the updated instructions and FAQ over at WP.org (follow the download link). Although the old syntax will still work, I’ve made a few changes.

30 comments »

1
Jon Griffith contributes
at 10:52 pm on January 6, 2008 #

I’ve got another one for you. Thanks for the quick modification. Can you have a look at my eBay RSS feed at the bottom of this page and help me make heads or tails of the configuration? I have tried whatever I can figure to get the plugin to read specific fields in the array, but I’m quite confused now.

I’m attempting to add my listings with the Price, Title, Image, Current Bid, etc…to my widget. Maybe you have a clue???

Blog is the website I submitted in this comment, rss feed is at the bottom of my eBay store:
[link]

2
Thus saith Adam
at 10:13 am on January 7, 2008 #

If you’re not sure how to display the title, then I’ll point you toward the documentation to start. As for the other fields, they’re more complex.

Usually I would just point you to the widget’s built-in debugger (see FAQ), but since your feed url has ? and & in it, that won’t work quite right. If you want to use the debugger (which would make this easier for you), pass your feed through FeedBurner first, then it will work.

But in the meantime, here’s a couple pointers. If you look in the RSS feed, you’ll see information in fields like these:

<rx:BuyItNowPrice xmlns:rx="urn:ebay:apis:eBLBaseComponents">14900</rx:BuyItNowPrice>
<rx:CurrentPrice xmlns:rx="urn:ebay:apis:eBLBaseComponents">99</rx:CurrentPrice>

Note that the field names have a : in them. When WP parses the feed, it turns that into an array (and the names become lower case):

[rx] => array(
   buyitnowprice => 14900,
   currentprice => 99,
   ...
)

The widget’s documentation explains how to display items from an array. The simplest way is to use something like this:

Buy now: ^rx=>buyitnowprice$ <br /> Current price: ^rx=>currentprice$

You would use the same method to display g:image_link.

3
John contributes
at 3:44 pm on January 7, 2008 #

My problem is that the feed I want to show appears with the oldest items first. So if I choose to to show 6, then I see the 6 oldest not the 6 newest. Can I easily list the feed from the bottom? Or could provide a ‘reverse order’ option?

4
Thus saith Adam
at 4:21 pm on January 7, 2008 #

John, starting at line 226 you should see this:

// PART II: PREPARE ITEM INFORMATION
			if ( is_array($rss->items) && !empty( $rss->items ) ){
				$rss->items = array_slice($rss->items, 0, $this->num_items);

Insert one line so it looks like this:

// PART II: PREPARE ITEM INFORMATION
			if ( is_array($rss->items) && !empty( $rss->items ) ){
				$rss->items = array_reverse( $rss->items );
				$rss->items = array_slice($rss->items, 0, $this->num_items);

If you use multiple instances of my widget on your blog, note that this will affect all of them. If that’s the case, use this slightly more complicated edit instead so that it affects only one instance of the widget (edit where indicated):

// PART II: PREPARE ITEM INFORMATION
			if ( is_array($rss->items) && !empty( $rss->items ) ){
				if ($this->url == 'PUT FEED URL HERE')
					$rss->items = array_reverse( $rss->items );
				$rss->items = array_slice($rss->items, 0, $this->num_items);
5
John P. comments
at 3:11 pm on January 8, 2008 #

Had a problem getting the widget to pass validation XHTML 1.0 Strict when I updated to 2.0. Seems the widget title opens an li tag (with id kb-advanced-rss-#) and doesn’t close it.

6
Thus saith Adam
at 3:23 pm on January 8, 2008 #

Thanks for catching that. I mistakenly used echo $this->after_widget; instead of echo $after_widget; on line 444.

Version 2.0.1 will be up on wp.org within a few minutes.

7
Bob Jewell says
at 8:45 pm on January 12, 2008 #

Just wanted to pass along a customization that I use:

I’ve had some issues with feeds that I Trust that I want to give fairly creative output to - i.e. I want to include html tags that actually get parsed, or javascript. A simple solution that I used was to update the item_cleanup function:
I moved the “some cleanup for security” section below the “apply opts, if given” section, and wrapped it in:
if (!isset($bypasssecurity)) {
}
So, now if i have a feed that I TRUST, I can just [opts:bypasssecurity].

8
Thus saith Adam
at 8:30 am on January 14, 2008 #

That’s a good idea–I’ll try to remember to integrate that into the next update.

9
Nick proclaims
at 4:37 pm on January 18, 2008 #

Hi
Great feed reader but is it possible to have the feeds open in a new window / tab (or maybe as a flyout)instead of the same window?
Thanks in advance.
Nick

10
John exclaims
at 4:44 pm on January 18, 2008 #

Thanks Adam. I now have the items coming out with the newest at the top. Could you consider adding a Reverse option to the widget configuration in a future release.

Also have a suggestion for any troubleshooting site. Many feed readers give the url of a feed as feed://... If you paste this into the widget it does not work. You have to change it to http://...

Thanks again
John

11
Thus saith Adam
at 5:29 pm on January 18, 2008 #

@Nick: Yes, just write the necessary HTML (or javascript) into the widget options. That’s sort of the point–DIY. :) The easiest way is to set the target="_blank" attribute in the <a> tag. Further reading.

@John: You’re correct about the feed:// thing. That’s thrown people off before. I need to remember to have the widget automatically strip that off.

As for an option to reverse the order… Maybe. That’s a rare request; introducing too many standard options bloats the code, and I’m not sure enough people would use it to warrant doing it. We’ll see.

12
Nick writes
at 9:59 am on January 19, 2008 #

Hi Adam
Thanks for your quick reply I am totally new to this I have had a look at your reply and the linked page tried some editing bit am unable to get it to work any chance you could perhaps give me another hint?
Cheers
Nick

13
Thus saith Adam
at 12:51 pm on January 19, 2008 #

In general,

<a href="url" target="_blank">link text</a>

So maybe

<a href="^link$" target="_blank">^title$</a>

or whatever you like. Note, though, that many people configure their browsers to ignore the _blank attribute. And many of those who don’t wish that they knew how–this sort of thing annoys lots of folks.

14
Dan remarks
at 11:36 am on January 22, 2008 #

I’m getting the “feed is probably down” error, but that’s because the feed is empty (it’s a weather warnings feed, and often there’s no warnings).

Is there a way to change the error text shown? I know the feed works, so I’d rather it said something like “No warnings at this time” instead.

PS posting here as comments on the previous post are closed.

15
Thus saith Adam
at 11:41 am on January 22, 2008 #

Dan, check out the discussion starting with this comment. It’s probably worth your while to read the entire conversation (around a dozen comments) before fiddling with the code, though.

16
Dan comments
at 4:46 pm on January 22, 2008 #

Cheers, that works perfectly. Maybe add that tip to the FAQ?

17
Thus saith Adam
at 1:05 pm on January 23, 2008 #

Good idea, I’ll try to remember on my next update.

18
Dan opines
at 5:29 am on January 24, 2008 #

I spoke too soon — today warnings have been issued, but the widget didn’t appear. Removing the bit of code added:


if ( !is_array( $rss->items ) )
return;

Restored the widget. I put it in and took it out again to confirm.

19
Thus saith Adam
at 9:44 am on January 28, 2008 #

Sorry for the delay, I’m swamped with my work right now. Two thoughts:

First, where exactly did you paste that code? If it’s in the wrong place, it will kill the widget.

Second, the widget checks the feed only once every hour or so. If the warning was issued, but you waited less than an hour to check your site, don’t be surprised if it takes an hour for it to show up on your site.

20
Dan proclaims
at 4:01 pm on January 28, 2008 #

I pasted the code into Notepad2 and did a search for:

echo $before_widget;

21
Dan exclaims
at 4:01 pm on January 28, 2008 #

Sorry, typo. Should be:

I pasted the code into Notepad2 and did a search for:

echo $before_widget;

Then pasted the suggested code right before that.

The warning had been out for around nine hours at the time (I did do a check with the tool built into the widget too).

22
Thus saith Adam
at 5:49 pm on January 28, 2008 #

Dan: Get version 2.1. I just released it today. There’s now a checkbox that will solve all your worries.

23
Dan proclaims
at 5:23 am on January 29, 2008 #

Thanks!

24
Alessandro proclaims
at 6:00 am on February 1, 2008 #

Hi, ive a problem, when i show my (rss title) it convert the ‘ or ” with ? why this??

25
jack writes
at 4:57 am on February 20, 2008 #

hi, i’m trying to make a tipoftheday sidebar. i am posting to a specific category and the posts are short. is there a way to rss the whole post and not jsut the title with oyur plugin?
many thanks

26
Thus saith Adam
at 2:24 pm on March 25, 2008 #

Jack: Yes, read the documentation.

Alessandro: I just noticed the comment. If you’re still wrestling with it, let me know.

27
Loban thinks
at 1:01 pm on March 27, 2008 #

I don’t know what I’m doing wrong, but I still can’t get the RSS Feed Widget to work. If I go to the actual feed URL in Firefox or something, it shows a whole bunch of stuff. It’s correct in other words, but the KB RSS Widget only shows one item.

I’m trying to use this plugin to show my gallery updates in my sidebar (new albums, new pics, etc.), but it doesn’t seem to update. The feed itself is working fine, I can subscribe in Firefox and everything works, but nothing shows up in the widget but one item.

28
Thus saith Adam
at 1:33 pm on March 27, 2008 #

Standard response:

(1) Check the FAQ, particularly the “how do I debug the feed” stuff. (It’s possible that WP sees only one item in the feed.)

(2) I can’t tell you anything more specific without seeing the feed URL. But first look through the faq.

29
Loban comments
at 7:22 am on March 28, 2008 #

Right, I figured I’d get referred to documentation, which is fine. I just thought I’d ask anyway. I can provide you the feed URL if you’d like.

30
Aaron remarks
at 8:26 pm on May 10, 2008 #

I cant seem to figure out how to make more than 10 entries from the atom feed to appear in the widget output. I’ve selected : Number of items to display: 42 (there are 42 entries on the category) and only 10 show up.

Leave a comment

Comment Guidelines
  • Yes, your comments will be visible to everybody. (Unless you use the private contact form.)
  • Allowed HTML: <a> <b> <blockquote> <cite> <code> <em> <i> <strong>
  • Code: Put code in `backticks` (above your "Tab" key) or it won't display well
  • Gravatars: To override the default image by your comment, use a gravatar
  • Links: If you include more than one link, your comment will go into the spam queue

Please read before commenting: Because my real job has me swamped at the moment, I am not supporting my plugins at this time. Sorry. This may last several weeks.

If you have a bug report, feature request, or other general feedback about a plugin, please leave a comment—but do not expect an immediate response. If you are requesting help, though, please check the plugin's documentation thoroughly rather than ask your question as a comment.

Thank you for your understanding.