Hi folks,
I need help with RSS widget in wp. I think you know that widget and I would need to add it like php function on my blog. Basicly that widget is added on the sidebar but I want to add it on the footer and like php function instead. Well, the output item looks like this in source:
<ul><li><a class='rsswidget' href='http://feeds.feedburner.com/~r/Phonearea/~3/285950275/' title='Phone Arena makes a hands-on preview of LG KF700, a phone that highly resembles the Viewty, but features a numeric keypad and a thumb-wheel on the back. '>VIDEO: LG KF700 Preview</a><span class="rss-date">May 8, 2008</span> <cite>Phone Arena</cite></li></ul>
I found a function which maybe is used for that in widgets.php file in wp-includes called wp_widget_rss_output:
function wp_widget_rss_output( $rss, $args = array() ) {
if ( is_string( $rss ) ) {
require_once(ABSPATH . WPINC . '/rss.php');
if ( !$rss = fetch_rss($rss) )
return;
} elseif ( is_array($rss) && isset($rss['url']) ) {
require_once(ABSPATH . WPINC . '/rss.php');
$args = $rss;
if ( !$rss = fetch_rss($rss['url']) )
return;
} elseif ( !is_object($rss) ) {
return;
}
extract( $args, EXTR_SKIP );
$items = (int) $items;
if ( $items < 1 || 20 < $items )
$items = 10;
$show_summary = (int) $show_summary;
$show_author = (int) $show_author;
$show_date = (int) $show_date;
if ( is_array( $rss->items ) && !empty( $rss->items ) ) {
$rss->items = array_slice($rss->items, 0, $items);
echo '<ul>';
foreach ($rss->items as $item ) {
while ( strstr($item['link'], 'http') != $item['link'] )
$item['link'] = substr($item['link'], 1);
$link = clean_url(strip_tags($item['link']));
$title = attribute_escape(strip_tags($item['title']));
if ( empty($title) )
$title = __('Untitled');
$desc = '';
if ( isset( $item['description'] ) && is_string( $item['description'] ) )
$desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['description'], ENT_QUOTES))));
elseif ( isset( $item['summary'] ) && is_string( $item['summary'] ) )
$desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['summary'], ENT_QUOTES))));
$summary = '';
if ( isset( $item['description'] ) && is_string( $item['description'] ) )
$summary = $item['description'];
elseif ( isset( $item['summary'] ) && is_string( $item['summary'] ) )
$summary = $item['summary'];
$desc = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($summary, ENT_QUOTES))));
if ( $show_summary ) {
$desc = '';
$summary = wp_specialchars( $summary );
$summary = "<div class='rssSummary'>$summary</div>";
} else {
$summary = '';
}
$date = '';
if ( $show_date ) {
if ( isset($item['pubdate']) )
$date = $item['pubdate'];
elseif ( isset($item['published']) )
$date = $item['published'];
if ( $date ) {
if ( $date_stamp = strtotime( $date ) )
$date = '<span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date_stamp ) . '</span>';
else
$date = '';
}
}
$author = '';
if ( $show_author ) {
if ( isset($item['dc']['creator']) )
$author = ' <cite>' . wp_specialchars( strip_tags( $item['dc']['creator'] ) ) . '</cite>';
elseif ( isset($item['author_name']) )
$author = ' <cite>' . wp_specialchars( strip_tags( $item['author_name'] ) ) . '</cite>';
}
echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>";
}
echo '</ul>';
} else {
echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>';
}
}
well, I need to get the same output like when I added in admin menu:number of items, title, date and author. Will you help me like to get it from that function?
I have tried this
<?php require_once(ABSPATH . WPINC . '/rss.php'); wp_widget_rss_output('http://feeds.feedburner.com/Phonearea', 5);
?>
but its not what Im looking for