Ugly title parsing in K2 RSS Sidebar Module
-
Hey all, I’ve been having a problem with my RSS sidebar module. This does pertain specifically to a K2 module, but I think it’s really more of a general WordPress/PHP question.
The RSS module grabs my Google Reader feed with fetch_rss and runs it through some formatting to create a list of links. My issue is that in my Google Reader feed, the <title> attribute occurs twice for each <entry>. Here is a simple diagram of the structure:
<entry> <title>Post title</title> <source> <title>Blogname</title> </source> </entry>
The problem with the current formatting code is that it just throws the two titles together, creating links that look like “Post titleBlogname”. I’d like to have them look more like “Post title – Blogname”. It would also be cool to use the <link> given in the <source> block to link the Blogname to the Blog’s URL, but this is not neccessary by any means.
I have pasted the RSS Module’s code for easy inspection. Please see my blog for an example of this in action- look for the “Google Reader highlights” in the sidebar.
Does anyone have an idea of how I should go about adding the proper delimiters between the two titles? I am obviously not much of a PHP coder, so any help would be appreciated.
WordPress 2.1.2 & K2 0.95 RC1
- The topic ‘Ugly title parsing in K2 RSS Sidebar Module’ is closed to new replies.