DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Web marketing expert & entusiest web designer Sagive has posted 2 posts at DZone. You can read more from them at their website. View Full User Profile

Intergrate an rss feed to Wordpress Dashboard

06.21.2013
| 2007 views |
  • submit to reddit
add_action('wp_dashboard_setup', 'remove_dashboard_widgets');
function remove_dashboard_widgets() {
     global $wp_meta_boxes;
     // remove unnecessary widgets

     // var_dump( $wp_meta_boxes['dashboard'] ); // use to get all the widget IDs

     unset(
          $wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'],
          $wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary'],
          $wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']
     );
     // add a custom dashboard widget

     wp_add_dashboard_widget( 'dashboard_custom_feed', __('News from Example.com', 'sagive'), 'dashboardSelectedFeedDisplay', 'side', 'high' ); //add new RSS feed output

}
function dashboardSelectedFeedDisplay() {
     echo '<div class="rss-widget">';
     wp_widget_rss_output(array(
          'url' => 'http://www.example.com/feed',
          'title' => 'Example Site Welcome Title',
          'items' => 2,
          'show_summary' => 1,
          'show_author' => 1,
          'show_date' => 1,
     ));
     echo "</div>";
}

A great, Easy to use function which enables you to intergrate an RSS feed into a wordpress website dashboard...

Very usefull to web-designers and website managers looking to stay up to date!

Also this function would locate your RSS widget on the top left corner of your WP site dashboard