• Hi! πŸ™‚
    There’s a way, maybe via functions.php, to show, in the 4.4.2 version, the old “latest comment” widget in dashboard, like in the 3.7 version of WordPress?

    The new “activity” pane is very uncomfortable, with the latest comment at the bottom, and I want to show latest comments in a widget apart, with possibility to moderate and reply, like in the actual “activity” widget but in a widget apart!

    Thanks! πŸ™‚

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Dashboard widgets are basically meta boxes, except they are added with wp_add_dashboard_widget(). You could simply copy the comment widget function from the 3.7 code base into your functions.php, then add it with the above function. Of course you can modify this function as you see fit since it is no longer “core” code. There may be some loose ends to resolve, like name conflicts, but that’s basically all there is.

    If you don’t see your widget after it has been added, you may just need to check its box in the screen options pull down tab at upper right of the dashboard.

    Thread Starter doppiar

    (@doppiar)

    Mhhh…

    The 3.7 code is:

    if ( is_blog_admin() && current_user_can('moderate_comments') ) {
    		if ( !isset( $widget_options['dashboard_recent_comments'] ) || !isset( $widget_options['dashboard_recent_comments']['items'] ) ) {
    			$update = true;
    			$widget_options['dashboard_recent_comments'] = array(
    				'items' => 5,
    			);
    		}
    		$recent_comments_title = __( 'Recent Comments' );
    		wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments', 'wp_dashboard_recent_comments_control' );
    	}

    Now, how I can implement in the functions.php file? Thanks πŸ™‚

    EDIT – If I try to implement all in functions.php, WordPress says:

    Fatal error: Call to undefined function wp_add_dashboard_widget() in functions.php on line 28

    Moderator bcworkz

    (@bcworkz)

    Make your code into a callback function that is added to the ‘admin_init’ action. The code you have now is being called for front end requests where the add widget function is never defined.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Old latest comments dashboard widget’ is closed to new replies.