<?php
function sp_widget() {
    require_once(ABSPATH.WPINC.'/rss.php'); 
    if ( $rss = fetch_rss( 'http://feeds2.feedburner.com/studiopress' ) ) {
        $content = '<div class="rss-widget>"';
        $content .= '<p style="border-bottom: 1px solid #ccc; padding-bottom: 10px; font-weight: bold;"><a rel="nofollow" href="http://www.studiopress.com/themes/pro-plus">Upgrade now to the Pro Plus All-Theme package for only $140 --></a <br /> <small>(Use PPUPG as the discount code when you are on the shopping cart page.)</small></p>';
        $content .= '<ul>';
        foreach ( array_slice( $rss->items, 0, 5 ) as $item ) {
            $content .= '<li>';
            $content .= '<a class="rsswidget" href="'.esc_url( $item['link'] ).'">'.htmlentities( $item['title'] ).'</a>';
            $content .= ' <span class="rss-date">'.date('F j, Y',strtotime($item['published'])).'</span>';
            $content .= '<div class="rssSummary">'.htmlentities( $item['summary'] ).'</div>';
            $content .= '</li>';
        }
        $content .= '</ul>';
		$content .= '<p style="border-top: 1px solid #ccc; padding-top: 10px; font-weight: bold;"><a target="_blank" href="http://feeds2.feedburner.com/studiopress"><img style="vertical-align:middle;margin:0px 3px 3px 0px;" src="http://www.studiopress.com/images/rss.png" alt="Subscribe to StudioPress" /></a><a target="_blank" href="http://feeds2.feedburner.com/studiopress">Subscribe to RSS</a><a target="_blank" href="http://feedburner.google.com/fb/a/mailverify?uri=studiopress"></a>&nbsp;&nbsp;<img style="vertical-align:middle;margin:0px 3px 3px 0px;" src="http://www.studiopress.com/images/rss.png" alt="Subscribe to StudioPress" /></a><a target="_blank" href="http://feedburner.google.com/fb/a/mailverify?uri=studiopress">Subscribe via Email</a></p>';
        $content .= '</div>';
        echo $content;
    }
}
 
function sp_widget_setup() {
    wp_add_dashboard_widget( 'sp_db_widget' , 'The Latest News From StudioPress' , 'sp_widget');
}
 
add_action('wp_dashboard_setup', 'sp_widget_setup');  
?>