• Resolved SJW

    (@whitsey)


    I am using hungryfeed and it works ok for basic stuff but I am having troubles implementing advanced features. I have read the doco and it doesn’t really explain very clearly how to do what I want or if I can do it at all…

    My feed has lots more elements than title, description, date and author… I have about 15 fields in total.

    I’ve tried adding the field in the template i.e. {{ImageField}} and then tried using {{data[‘ImageField’]}} and then tried using showdata=”1″ and yet nothing I do will display the image URL.

    I would have thought this would be a basic feature but I cannot seem to find anything anywhere that clearly describes how to implement it?

    Is that because it cannot be done?

    http://wordpress.org/extend/plugins/hungryfeed/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Jason

    (@verysimple)

    Well, hungryfeed makes it easy to access the standard RSS fields but if the feed has extra non-standard fields then you have to use the data array to display them. To be honest it can be tricky to figure out the path because the RSS array structure is so many levels deep including the xml namespaces and everything

    here is an example of a data path to get the the “source” url:

    {{data[‘child’][”][‘source’][0][‘attribs’][‘url’]}}

    here’s an example from iTunes for getting the “price” field of an app:

    data[‘child’][‘http://itunes.apple.com/rss’%5D%5B‘price’%5D%5B‘0’%5D%5B‘data’%5D

    you can use show_data=”1″ (make sure you have the underscore) to have hunryfeed output the raw data array and then you have to do a little detective work to figure out the path to the field that you want.

    hope that helps?

    I think I’ve got a similiar problem.

    I want to display a feed from a racing-calendar but the date that shows is one day to early. The date (2011-12-17) come from a field called y:published as you can see on this link from a printscreen of yahoo-pipes but I want to show the correct date which I can see under the label dc:date (2011-12-18T00:00:00+01:00) and also in the html of the feed.

    Could you please help me with this?

    Link to printscreen of yahoo-pipes
    Link to show_data.txt

    Plugin Contributor Jason

    (@verysimple)

    it looks like it could be something like this:

    data[‘child’][‘http://purl.org/dc/elements/1.1/’%5D%5B‘date’%5D%5B0%5D%5B‘data’%5D

    unfortunately it’s kinda hard to figure out without some experimenting. i’d like to find a better way to handle that but at the moment i’m not sure I have any great solutions for that extra data

    Great! It worked out just fine!
    Just one more thing. Could you please help me with how to convert the output to not show the timestamp.

    2011-12-18T00:00:00+01:00 -> 2011-12-18

    Plugin Contributor Jason

    (@verysimple)

    Well at the moment HungryFEED doesn’t have any capability because it just treats everything like text. but i think there are two options that would work.

    1. add some custom javascript in the HungryFEED settings to look for those dates, parse and re-format them. that wouldn’t be too difficult to write for anybody that knows javascript, expecially with jquery.

    2. see if yahoo-pipes offers a feature to process data before it’s returned…? I don’t know if that’s possible but perhaps it’s worth investigating?

    I see.

    I used yahoo-pipes to filter out some special categories and to sort the feed but after stumbled upon your great rss-plugin I’m happy to see it’s all done by your plugin!

    I’m no programmer in neither javascript nor php but I thought of a php-function that just trimmed the last part of the string. Maybe it’s as easy with javascript but I’m not sure of how to do it. I guess I could put in a php script in the template, surrounding the string I want to change..?

    Plugin Contributor Jason

    (@verysimple)

    the template would be something like this, giving your value a class name so it can be located in the javascript:

    <div class="timeField">{{yourtimefield}}</div>

    then the javascript would be something like this using jquery, you’d have to write the time parsing function, you could probably find somebody on stackexchange to help with that

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    
      $('.timeField').each(function(index)
      {
        var oldTime = $(this).html();
        var newTime = oldTime.split('T')[0]; // (provide your time parsing code here)
        $(this).html(newTime);
      });
    
     });
    </script>
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: HungryFEED] How to display other elements from feed’ is closed to new replies.