WordPress.org

Ready to get started?Download WordPress

Forums

Line Breaks in RSS Feed? (12 posts)

  1. stew278
    Member
    Posted 8 years ago #

    How do get line breaks to show up in RSS feeds, instead of having to manually put in a <br> tag after every hard return???

  2. niziol
    Member
    Posted 8 years ago #

    It adds in the paragraph tags tags at hard-returns automatically. Do you mean you want to have line-breaks and paragraphs together?

  3. stew278
    Member
    Posted 8 years ago #

    In the Excerpt field, it doesn't recognize line-breaks/hard-returns automatically, and I've had to put in manually <br> tags to force a line-break. i'd like to find a better way of doing this instead of doing it manually each time.

  4. Kafkaesqui

    Posted 8 years ago #

    If you're providing full feeds (Options > Reading, Syndication Feeds section), post content will then be run through WP's normal text format filters. So in that case line breaks are preserved (actually, everything is).

  5. stew278
    Member
    Posted 8 years ago #

    Right ... that was the way I had it before, but made the change to show "Summary" as opposed to "Full Text." The reasoning was because I have a recipe website that the authors put a personal write-up/summary of their recipe in the "Content" field. Then, there are custom fields each for cooking time, serving size, ingredients, directions.

    I wanted the RSS feed to include just the custom fields, but have not found a working solution to do that (if there were one, could someone point out how to have custom fields displayed in an RSS feed?), so I have re-entered info into the "Excerpt" field, and the RSS feeds are pulling that info. This all is happening so that the info can be synced with people's iPods, but it's not as slick as I was hoping for.

    At this point, I'd be happy to address the line-break issues I'm having, but am open to other suggestions about this issue .....

  6. Kafkaesqui

    Posted 8 years ago #

    I can provide a number of suggestions (and maybe even a solution or two), but I have a question before putting some work time in on it: Exactly how would you like your feeds to appear?

    Is your ideal to display *just* this custom field data? If so, what form does it take (is it more than one field we're talking about, since you mention a bunch up there)? How should it display in the feed?

  7. stew278
    Member
    Posted 8 years ago #

    Thanks Kafkaesqui ... Hope this helps, otherwise, just let me know what I'm missing in my explanation.

    What I would like to have the RSS feed display are the custom fields for the recipes in the website. There are a total of 5 custom fields being used, in conjunction with the content field. The custom fields are:

    <?php echo c2c_get_custom('Preparation Time'); ?>
    <?php echo c2c_get_custom('Cooking Time'); ?>
    <?php echo c2c_get_custom('Serving Size'); ?>
    <?php echo wpautop(c2c_get_custom('Ingredients')); ?>
    <?php echo wpautop(c2c_get_custom('Directions')); ?>

    The content field displays a short write-up of the recipe by the author (as described above). As I stated, I have right now the excerpt field filled with the information from all 5 of the custom fields, which I copied and pasted in and then formated by adding <br> tags because the line breaks were not showing up. I'd like it if I could get the custom fields to display in the RSS feed, thus saving me the heartache and pain of having to manually go in and edit information into the excerpt field.

    You can view what the recipes look like online here. Except for the short paragraph written by the author, everything else (from Title down to Directions) would ideally be shown in the RSS feed.

    This may seem ridiculous, but am setting it up so that with the help of freeware apps, one could sync recipes from the site onto their iPod and take them with. (RSS feeds is the way to go with the freeware apps ... wouldn't mind finding something though that could kick out a WP entry as a text field, and then a person could add that to their Notes on their iPod ... one entry vs. them all)

    Sorry ... lots of questions here. Hopefully you, or someone else that has some interest in it, could help out addressing them.

  8. stew278
    Member
    Posted 8 years ago #

    bump

  9. adistarmid
    Member
    Posted 8 years ago #

    Any solution to this? I too am looking for a way to incorporate custom field values onto a feed.

    For example, from stew's post, maybe something in this format:

    <details/>
    <cooking-time>3 hours</cooking-time>
    <serving-size>12</serving-size>
    <ingredients>Lettuce, tomatoes</ingredients>
    <directions>Preheat oven...</directions>
    </details>

    Anyone have ideas?

  10. Kafkaesqui

    Posted 8 years ago #

    I guess since I originally offered...And sorry about the delay stew278. This thread got lost in the activity of the forum. Anyway:

    Custom2Feed Content plugin:

    download plugin | view source

    The plugin appends custom keys/values (those matching keys listed in $pass_keys array - see below) to post content in RSS2, Atom and RDF/RSS1 feed formats. Install the normal way: download file, upload to your WordPress plugin directory (wp-content/plugins/), and activate Custom to Feed Content under Plugins.

    There are a few user-configurable variables in the plugin file. These can be modified through the plugin editor, or offline in a text editor. The variables are:

    $pass_keys
    Array of custom keys the plugin watches for. Modify the default array list to fit your requirements. For example:

    $pass_keys = array('Preparation Time', 'Cooking Time', 'Serving Time', 'Ingredients', 'Directions');

    $list_mode
    Defines whether to display custom fields in a HTML list (and what type), separate paragraphs or pseudo-tags (<key>value</key>). Options are: 'ul' (unordered list), 'ol' (or 'ol-1' - numbered ordered list), 'ol-A' (lettered ordered list), 'dl' (definition list), 'p' and 'tag' (pseudo-tag format).

    Note the pseudo-tag format is not an XML def. Syndication formats have very specific DTDs/specs, and one cannot just stick new elements in a feed (and even if we could, appending them to the post content wouldn't work). So sorry adistarmid, but this does not quite provide what you are seem to be asking for.

    $sep
    Custom separator character(s). This delimits the key:value pairs (as ':' did just now). Default is ': '.

  11. shua
    Member
    Posted 7 years ago #

    Great plugin! I have a slightly modified need howwever...

    I am creating a Page that has content, excerpt, and a few custom fields.

    I have created separate feed templates to serve just the_content, the_excerpt, and would like to serve JUST a custom field of my choice.

    it would be great to use something like:

    <content type="html"><![CDATA[<?php echo c2c_get_custom('custom'); ?>]]></content>

    any thoughts?

  12. shua
    Member
    Posted 7 years ago #

    ugh!

    answered my own question....

    I shame myself.

    DONT DELETE THE LOOP FROM THE TEMPLATE!

Topic Closed

This topic has been closed to new replies.

About this Topic