WordPress.org

Support

Support » Plugins and Hacks » Hacks » Problem creating a RSS dashboard widget

Problem creating a RSS dashboard widget

  • I’m trying to build a RSS dashboard widget that would use the built-in WP functions as I would like to add the “configure” option to my widget, and none of the tutorials I’ve been able to find have been all that elegant. I can get the widget created and displayed on the dashboard, however when I set the widget options, they don’t seem to take, which causes problems down the line (as in RSS feed not loading because it doesn’t exist, etc…)

    function register_dashboard_widget() {
            if ( ! isset( $widget_options['acshortcodes'] ) ) {
    		$update = true;
    		$widget_options['acshortcodes'] = array(
                        'link' => 'http://arconixpc.com/tag/arconix-shortcodes/',
                        'url' => 'http://arconixpc.com/tag/arconix-shortcodes/feed/',
                        'title' => 'Arconix Shortcodes',
                        'items' => 2,
                        'show_summary' => 1,
                        'show_author' => 0,
                        'show_date' => 1,
    		);
    	}
    
            wp_add_dashboard_widget('acshortcodes', $widget_options['acshortcodes']['title'], array( $this, 'dashboard_widget_output' ), array( $this, 'dashboard_widget_control' ) );
        }
    function dashboard_widget_output() {
            echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>'; }
    function dashboard_widget_control() {
            wp_dashboard_rss_control( 'ac_shortcodes', array( 'link' => false, 'title' => false, 'show_author' => false ) ); }

    This essentially mirrors the same set of functions put out by the WordPress Blog RSS widget in wp-admin/includes/dashboard.php and yet all I can get is a “loading…” with no AJAX call because none of the widget options are loaded (when I click configure, the RSS feed box is empty). I’m sure it’s something stupid… any ideas what I’m doing wrong?

  • The topic ‘Problem creating a RSS dashboard widget’ is closed to new replies.
Skip to toolbar