Title: RSS Widget (sidebar) coding?
Last modified: August 19, 2016

---

# RSS Widget (sidebar) coding?

 *  [Nicki Faulk](https://wordpress.org/support/users/nitallica/)
 * (@nitallica)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/rss-widget-sidebar-coding/)
 * I’d like to re-format how RSS feeds are displayed in my sidebar. I’ve added an
   entry to my functions.php but am having a heck of a time finding the code to 
   generate the RSS feeds in the sidebar. Does anyone know where I can find this?
 * I tried looking in the widgets.php file in wp-includes, but when I plopped that
   code into my widget_mytheme_rss() function, the result is the pre-programmed 
   error message: “An error has occurred; the feed is probably down. Try again later.”
 * Code snippet:
 *     ```
       function widget_mytheme_rss() {
       	//$title ? print($before_title . $title . $after_title) : null;
   
       	if ( is_array( $rss->items ) && !empty( $rss->items ) ) {
       		$rss->items = array_slice($rss->items, 0, $num_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 ( $show_summary ) {
       				$summary = '<div class="rssSummary">' . $item['description'] . '</div>';
       			} else {
       				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))));
       				$summary = '';
       			}
       			echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>$summary</li>";
       		}
       		echo '</ul>';
       	} else {
       		echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>';
       	}
       } 
   
       if ( function_exists('register_sidebar_widget') )
       	register_sidebar_widget(__('Links'), 'widget_mytheme_links');
       ?>
       ```
   
 * Any help/ideas, or a general nudge in the right direction would be VERY helpful.
   Thanks!

The topic ‘RSS Widget (sidebar) coding?’ is closed to new replies.

## Tags

 * [Feeds](https://wordpress.org/support/topic-tag/feeds/)
 * [RSS](https://wordpress.org/support/topic-tag/rss/)
 * [sidebar](https://wordpress.org/support/topic-tag/sidebar/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * 0 replies
 * 1 participant
 * Last reply from: [Nicki Faulk](https://wordpress.org/support/users/nitallica/)
 * Last activity: [18 years, 2 months ago](https://wordpress.org/support/topic/rss-widget-sidebar-coding/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
