RSS Standards

RSS Optimization

Events

Sponsored Links

WordPress: External RSS Feeds Optimization with KB Advanced RSS

Apart from its own Ice Tea tech blog, Dipot.com also displays two external relating to Optimization and Standards. I needed to optimize the post titles of these two by getting rid of their long suffixes, both for better looks and for more content within the same space.

The were served by the standard RSS WordPress 2.7.1 widget, which is fine, except it does not support much customization. After some search, I found Advanced RSS 1.0.1 WordPress plugin and KB Advanced RSS 2.1.3 WordPress plugin. Smart RSS only works until WP 2.7.0 and I didn’t want to tweak with that. only works until WP 2.6.2 and requires PHP5, DOM and XSL extensions loaded on the server and I don’t want to depend on those if I don’t need to, so the choice was easy.

Installation of KB worked flawlessly right from within wp-admin. Then, on my first attempt to configure it, I came across a problem which could very well had been a show stopper: for some reason, except for the feed’s URL and Title, the widget would not commit any of the other parameters to the “Options” table of the database. Troubleshooting this issue, I ended up reading all the users’ comments on the plugin’s site. As usual, I was not alone; this is a common issue. Thankfully, Wesley of  http://www.improvingtheweb.com had already posted the solution to PHP4 not committing widget field changes in WordPress. The solution worked like a charm. And, as expected, when I later upgraded to PHP5 the problem wasn’t even there to begin with.

KB is well thought-out, very straight forward with good documentation and examples. It supports all the features of the standard widget (including multiple instances) plus formatting and full support of all the feed’s fields to display or not (including the debugging tool to show which these fields are)! It further supports two modifiers to optionally manipulate the string before display, by taking out a number of characters from the start (ltrim) and/or trimming it to a specific length (trim).

Alas, what I actually needed was to take out a number of characters from the end of the string. Fortunately, as it turned out, KB ’s code is pretty straight-forward and extending it with my own modifier (rtrim) to do just that was only a matter of 3 lines of PHP code added to the version of the plugin that runs by my version of Wordpress; there’s one for versions up to 2.7 (pre-wp-2-7.php) and one for versions after that (post-wp-2-7.php). Here is the PHP code from the modified post-wp-2-7.php (my rtrim extension is in blue):

///////////////////////////////// CUSTOMIZATIONS /////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
// If you want to write customizations, put them here. The variable to modify is $text. See the FAQ.
/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////

// right trimming
// cuts $rtrim characters from the right
// by ageor, April 9, 2009
$rtrim = (is_numeric($rtrim) && 0<$rtrim) ? (int) $rtrim : null;
if (is_int($rtrim))
$text = substr( $text, 0, strlen($string)-$rtrim );

// left trimming:
$ltrim = (is_numeric($ltrim) && 0<$ltrim) ? (int) $ltrim : null;
if (is_int($ltrim))
$text = substr( $text, $ltrim );

// length trimming (do after left trimming)
$trim = (is_numeric($trim) && 0<$trim) ? (int) $trim : null;
if (is_int($trim))
$text = substr( $text, 0, $trim );

return $text;

The way this is written, the string in question can undergo any mix of all three trimming types necessary.

All setting up and troubleshooting took place by adding one instance of the widget and configuring it, then a second instance. When all was done and I had what I wanted, I removed the original two instances of the original RSS widget, positioned the new ones on top and saved, certain I was done. However, as the resulting “Widgets” Wordpress admin page suggested after saving, something was very wrorg. It displayed the message ‘You are using 3 widgets in the “Left Sidebar” sidebar’ but not the widgets themselves, nor the “Save Changes” button. Sure enough, I ended up with an unworkable site, as these where the first 2 widgets on the left column of Ice Tea tech and the page that appeared ended with the title banner. Disaster!

To cut a long story short, plenty of “trial and error”s later and with the help of Vicki of neTWire, here is my conclusion: For KB widget to work with WP 2.7.1 and the Atahualpa WordPress theme, the WordPress RSS widget needs to be activated and positioned above it. That’s how I temporarily solved my problem, until (if ever) I have the time to look deeper into the code involved or newer versions of  the theme and/or the plugin solve it for good.

Just to be clear, none of the problems and troubleshooting it took to solve them can be traced back ato KB alone. Atahualpa is a great but complex theme and it is their combination that turned out to be problematic. It’s not the first example of a bad mix and it won’t be the last. On the flip side, with each such incident we get to learn something new that will potentially save others and ourselves some frusrtation and time in the future.

Possibly related posts (auto generated)

PCs and the Internet: Addiction Magnets or just Tools?

The traditional Media (at least in Greece, where I live) don’t treat computing nor the Internet right. I don’t know if  it’s because of ignorance or because they feel threatened by it. However, I do get the impression that, most of the time, when radio, TV or the press mention PCs and/or the Internet it’s [...]

Feeds to Content & Categories Optimization in WordPress

At some point I added the category “Bookmarks” in Ice Tea tech. Thanks to the “YAAB” (short for Yet Another Auto Blogger) WordPress plugin, this category automatically gets its content directly from my Delicious feed. This way I get my own copy of what I put up there and my blog gets some added value [...]

WordPress Optimization: Compatibility between Themes & Plugins

The first incarnation of Ice Tea tech was in Joomla 1.5. I admit I can’t resist the temptation to tweak my own blog and never got to understand the Joomla philosophy well enough to do it extensively. So, with neTWire’s help (they set it up for me and successfully imported Joomla days’ posts), I [...]

FriendFeed Optimization Feature Requests

As I mention from time to time, I never have enough of a good thing. FriendFeed is more than good, it’s great. Greatness has a tencency to increase expectations. These are a few optimization suggestions to raise the experience from “great” to “near perfect” (as new requests will probably always exist):

Discussions is a great strength [...]

Optimize Firefox with 9+1 Must Have Add-ons

During my early days as an IT support person (well before USB flash drives, external hard disks and recordable CDs), I picked up the habit to not be dependent on anything not included in Windows (v. 3.0, at the time) if I could help it. So I got used to working on the setups my [...]

7 Favorite, Value Adding FriendFeed Applications

I like FriendFeed much better than Twitter; that’s no secret. In a conversation with @Trianta earlier today, it seems the only FriendFeed desktop clients out there are the Adobe Air-based Twhirl and feedalizr. They both leave a lot to be desired. There is also the announcement of  .NET-based FriendFeed Client. Web-based FriendFeed applications are also [...]

News Reading Thoughts

I never have enough of a good thing. The first time I read the online edition of a magazine I immediately wished for a filtered edition which would only contain the articles of my choice. When Greek Naftemporiki newspaper’s online-edition provided filtered, personalized content, I immediately wished for a method to push the content to [...]

Which Service should a Post go to?

I have been trying to organize/visualize the way I post, be it blogging, a comment on FriendFeed, an interesting link a came across etc. During the time it took me to complete the flowchart, more services were added as sources or carriers of my posts. As a result, the chart got more complex than originally [...]

Athens Startup Weekend 2008

First things first. I told them all in person and I’m saying it here as well. Special thanks go to Andrew Hyde, the mind behind Startup Weekends, Alexandros Pagidas, the person who brought it in Athens, Patrick Malone, our host in Microsoft Innovation Center venue (Patrick and Lydia, you definitely improved Microsoft’s image for all [...]