Posted By

xavsio4 on 05/20/11


Tagged

wordpress


Versions (?)

Removing feeds from Wordpress and add another one


 / Published in: PHP
 

URL: http://smashingmagazine.com

Taken from an article of http://smashingmagazine.com

  1. add_action('wp_dashboard_setup', 'my_dashboard_widgets');
  2. function my_dashboard_widgets() {
  3. global $wp_meta_boxes;
  4. // remove unnecessary widgets
  5. // var_dump( $wp_meta_boxes['dashboard'] ); // use to get all the widget IDs
  6. $wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'],
  7. $wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary'],
  8. $wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']
  9. );
  10. // add a custom dashboard widget
  11. wp_add_dashboard_widget( 'dashboard_custom_feed', 'News from yoursite', 'dashboard_custom_feed_output' ); //add new RSS feed output
  12. }
  13. function dashboard_custom_feed_output() {
  14. echo '<div class="rss-widget">';
  15. wp_widget_rss_output(array(
  16. 'url' => 'http://www.yoursite.com/feed',
  17. 'title' => 'What\'s up at yoursite',
  18. 'items' => 2,
  19. 'show_summary' => 1,
  20. 'show_author' => 0,
  21. 'show_date' => 1
  22. ));
  23. echo "</div>";
  24. }

Report this snippet  

You need to login to post a comment.