Skip to:
Content
Pages
Categories
Search
Top
Bottom

fetch RSS feed

  • How can i grab the RSS feed from bbpress and show it on WordPress?

    I want to show the latest 3 comments in the format:

    title

    summary (max 10 plain text exerpt length)

    Thanks in advance,

    DKB

Viewing 4 replies - 1 through 4 (of 4 total)

  • ricardouk
    Participant

    @ricardouk

    get the rss feed from bbpress by adding “rss” to the forum url

    http://www.domain.com/bbpress/rss

    copy the rss feed url and paste it on the rss/feed widget in wordpress

    Sorry i meant on a template like on homepage.


    ricardouk
    Participant

    @ricardouk

    you can use rss widgets on the homepage… if you mean “hardcoding it” to the template use the following code:

    <?php if(function_exists(‘fetch_feed’)) {

    include_once(ABSPATH.WPINC.’/feed.php’);

    $feed = fetch_feed(‘http://www.domain.com/bbpress/rss’);

    $limit = $feed->get_item_quantity(7); // specify number of items

    $items = $feed->get_items(0, $limit); // create an array of items

    }

    if ($limit == 0) echo ‘<div>The feed is either empty or unavailable.</div>’;

    else foreach ($items as $item) : ?>

    <div>

    get_permalink(); ?>”

    title=”<?php echo $item->get_date(‘j F Y @ g:i a’); ?>”>

    <?php echo $item->get_title(); ?>

    </div>

    <div>

    <?php echo substr($item->get_description(), 0, 200); ?>

    <span>[...]</span>

    </div>

    <?php endforeach; ?>

    and edit the following:

    $feed = fetch_feed(‘http://www.domain.com/bbpress/rss’);

    $limit = $feed->get_item_quantity(7); // specify number of items

    <?php echo substr($item->get_description(), 0, 200); ?>

    Thank you for the suggestion.

    With that code i get this:

    title

    first 10 words

    i want to have this:

    title

    first 10 words

    So there is too much spacing.

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.