• Is there are way to set the number of columns in the WordPress Admin Dashboard with a function?

    And then define which columns you want different widgets to be placed?

    I came accross the conversation here which talks about removing widgets.

    I will definitely be using that to remove widgets, but I’d also like to define where the remaining widgets are located (which column) and order too if that is possible.

    I want to do this just because I have a lot of users on my backend, and I want everything to look the same for everyone.

    Thanks for any help, I couldn’t find any info on those topics.

    Best,

    Adam

Viewing 3 replies - 1 through 3 (of 3 total)
  • Ced

    (@cedriccharles)

    Hellow ?? !

    Do you find something interresting ?

    In the same idea, I would like to force just one column in the dashboard… Right now, my dashboard widgets are set in the left column, but the user can still drag and drop a widget in an other column, and I don’t want that :/ !

    If possible, I want something that I can put in the function.php, not a plugin.

    Thanks a lot.

    So the good news is that this does what you need. The bad news is the user can’t set the columns anymore, and it breaks when changing the user moves widgets (see post below this one). Better code is needed, but maybe a starting point.

    // Set screen layout columns to 1
    global $current_user;
    get_currentuserinfo();
    $user_id = $current_user->ID;
    update_user_meta($user_id, 'screen_layout_dashboard', 1, '');

    I just did a little more testing, that code is horrible but maybe a starting point. If the user changes from 1 column to 2 and then puts something in column 2, the next visit will only show what was in column 1. The widgets that were moved into column 2 are “gone”. A better solution is needed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Setting Number of Columns in Dashboard and Defining Where Widgets are Placed’ is closed to new replies.