1

I cannot figure out how to arrange my custom widgets one left and one right.

I'm using this code to create custom widgets:

//Add my comments. Shows user his last 5 comments
function dashboard_user_comments_widget_function() {
    echo 'beh!';
}

function dashboard_user_add_comments_widget_function() {
     wp_add_dashboard_widget('my_comments_user_dashboard_widget', 'My comments', 'dashboard_user_comments_widget_function');
}
add_action('wp_dashboard_setup', 'dashboard_user_add_comments_widget_function');

Is there a way to pass a left/right variable into this function?

I read the codex page for it and the way they explain doing positioning is quite complicated, I don't know how to incorporate it.

1 Answer 1

0

The dashboard widget function wp_add_dashboard_widget() is just a wrapper for add_meta_box(). So you can use the underlying function instead.

add_meta_box(
     'my_comments_user_dashboard_widget'
    ,'My comments'
    ,'dashboard_user_comments_widget_function'
    ,$screen // Take a look at the output of `get_current_screen()` on your dashboard page
    ,'normal' // Valid: 'side', 'advanced'
    ,$priority // Valid: 'default', 'high', 'low'
);
1
  • Fantastic! you are awesome.
    – user8842
    Oct 18, 2012 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.