Info
- 5 posts
- 2 voices
- Started 1 year ago by DKB
- Latest reply from DKB
- This topic is not resolved
fetch RSS feed
-
- Posted 1 year ago #
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 -
- Posted 1 year ago #
get the rss feed from bbpress by adding "rss" to the forum url
http://www.domain.com/bbpress/rsscopy the rss feed url and paste it on the rss/feed widget in wordpress
-
- Posted 1 year ago #
Sorry i meant on a template like on homepage.
-
- Posted 1 year ago #
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); ?>
-
- Posted 1 year ago #
Thank you for the suggestion.
With that code i get this:
title
first 10 words
i want to have this:
title
first 10 wordsSo there is too much spacing.
-
You must log in to post.