Adding widget to dashboard with wp_dashboard_setup not working

Use this code to require the file from your theme’s functions.php file: require get_template_directory() . ‘includes/dashboard.php’; For the sake of completeness (and sanity) my dashboard.php file lives here: my-theme/includes/dashboard.php I took a closer look at the original issue, and I think what’s happening is that the require statement is silently failing because the wp-admin/includes/dashboard.php file … Read more

Is there any way to print a widget by having its id?

One way to do this would be to filter out all the other widgets in the sidebar while calling the dynamic_sidebar output. Updated to take widget index OR ID slug function custom_output_widget( $sidebar_id, $widget_id ) { global $custom_widget_target; // if ( !$sidebar_id ) { // $sidebars_widgets = get_option( ‘sidebars_widgets’ ); // print_r( $sidebars_widgets ); return; … Read more

How often does the RSS widget get updates?

RSS widget uses fetch_feed() function, which is setting default cache lifetime to 43200 seconds (12 hours). Since this value is filtered it can be overridden (as can feed cache overall). I did encounter plugin once, whose developer citing performance reasons completely disabled feed caching for all feeds.

Missing sidebar parameter “fix” – before_content

This code detects whether a title has been set, and if not, it changes the before_widget argument. add_filter( ‘widget_display_callback’, ‘wpse4213_widget_display_callback’, 10, 3 ); function wpse4213_widget_display_callback( $instance, $widget, $args ) { if ( empty( $instance[‘title’] ) ) { $args[‘before_widget’] = ‘<div class=”container”><div class=”content”>’; $widget->widget( $args, $instance ); return false; } return $instance; } This code works … Read more

How do you force a sidebar widget to have a container div around all child widgets?

Sidebar functionality doesn’t handle wrapping container, you need to add that on template level. Here is example markup of sidebar-primary.php template (taken from Hybrid theme and simplified a bit): if ( is_active_sidebar( ‘primary’ ) ) : ?> <div id=”primary” class=”sidebar aside”> <?php dynamic_sidebar( ‘primary’ ); ?> </div><!– #primary .aside –> <?php endif; ?> Also I … Read more