How can I set height of the categories checkbox meta box? The one thats shows when we want to post a new article.
I have found this https://wordpress.org/support/topic/change-the-fixed-heigth-of-the-box-filled-with-checkboxes-named-category but it is not working.
When I try to debug in Chrome I can disable max-height, it works great, but when I go in css and put the same copypasted code with changed values it just won’t.
.categorydiv div.tabs-panel, .customlinkdiv div.tabs-panel, .posttypediv div.tabs-panel, .taxonomydiv div.tabs-panel, .wp-tab-panel {
min-height: 42px;
max-height: 500px; // 200px is default
overflow: auto;
}
I just want to have larger box, because I have a lot of categories and scrolling is a bit tiresome.
If I am correct the style.css
(your theme style.css
) is not loaded in the admin area so creating a function solves this.
Side note: The code you where looking for I found in wp-admin/css/edit.css
at line 960
Below you find the function,hopefully this is what you where looking for.
Make backup from functions.php
(you know the drill)
Add following function to functions.php
function change_cat_meta_postbox_css(){
?>
<style type="text/css">
.wp-tab-panel, .categorydiv div.tabs-panel,
.customlinkdiv div.tabs-panel,
.posttypediv div.tabs-panel,
.taxonomydiv div.tabs-panel {
min-height: 42px;
max-height: 500px;/* change this to own wishes */
overflow: auto;
padding: 0 0.9em;
border: solid 1px #dfdfdf;
background-color: #fdfdfd;
}
</style><?php
}
add_action('admin_head', 'change_cat_meta_postbox_css');
Take a look here for some more info.
Just as a reminder, to change layout in the admin area(back-end) you need to create a function
and the correct hook
to achieve your goal.
side note 2: It probably changes height for all meta postboxes but find the right div and add it to the function should also solve that, cheers.