Latest Word

TUTORIALS, THOUGHTS and RAMBLINGS

Add Your Own News Feed to WordPress Dashboard

This is a quick tip on how to add a news feed to the WordPress Dashboard. For developers, this is a great way to stay in the front of your client by injecting your feed into the backend of their site.

The Dashboard already has several news feeds that load by default, most of which can be an annoyance. So let’s delete the unnecessary widgets (Plugins, WordPress Blog, WordPress News) and then add a widget that shows the most recent posts from your site.

Add this to your functions.php file.

add_action('wp_dashboard_setup', 'my_dashboard_widgets');
function my_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', 'The Latest from Adam Scott', 'dashboard_custom_feed_output' ); //add new RSS feed output
}
function dashboard_custom_feed_output() {
     echo '
'; wp_widget_rss_output(array( 'url' => 'http://www.adamscottcreative.com/feed', //put your feed URL here 'title' => 'What\'s up from Adam Scott', 'items' => 4, //how many posts to show 'show_summary' => 1, 'show_author' => 0, 'show_date' => 1 )); echo "
"; }

Here’s the result:

About the author

Adam Scott is a freelance designer, developer and online marketer that specializes in helping startup companies build their online presence.

Adam is available for freelance work, so hire him for your next project!

Enjoyed this post?

Subscribe to my RSS feed and receive updates in your email!

One Response to “Add Your Own News Feed to WordPress Dashboard”

  1. Magpie says:

    This is brilliant and I have used it before. But now a strange problem has occured. The custom feed displays fine when logged in as admin but when logged in as client (editor) it doesn't load and the toggle doesn't work.
    I tried removing and reinstating but it made no difference. Any ideas what the problem might be?
    (unfortunally the site is not live yet so i have no URL)

Leave a Reply

Copyright © 2011 Adam Scott. All rights reserved.