WordPress.org

Ready to get started?Download WordPress

Forums

Setting Number of Columns in Dashboard and Defining Where Widgets are Placed (4 posts)

  1. Adam Capriola
    Member
    Posted 3 years ago #

    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

  2. cedric.charles
    Member
    Posted 2 years ago #

    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.

  3. ktheisen
    Member
    Posted 2 years ago #

    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, '');
  4. ktheisen
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags