• Hi people.

    I’m inside the New Post page on WP-Admin, where you can create a new post.
    At the right column, there’s the category selector, in which you select the category for that new post.

    I have something like 15 categories, and therefore the category box is showing with a scrolling bar. Since I need to automate some post creation, I need all the categories to be visible right away, without having to scroll.

    So I found the css file that manages the height of the category box (it’s inside /wp-admin/css/edit.css and //wp-admin/css/edit-rtl.css) and there I changed the CSS files to allow a bigger height by default on that box.

    However when I open the new post page, it still shows the small box in categories, and when I see the CSS rule, the change I made is not visible. It’s like the CSS is cached or something. I already made sure that my browser is not caching it.

    The problem I think it’s because the CSS rules are not pulled directly from CSS files, but from this file:

    http://www.website.com/wp-admin/load-styles.php?c=0&dir=ltr&load%5B%5D=dashicons,admin-bar,buttons,media-views,common,forms,admin-menu,dashboard,list-tables,edit,revisions,media,themes,about,nav-menu&load%5B%5D=s,widgets,site-icon,l10n,wp-auth-check&ver=4.7

    That file seems to go and gather the CSS information from some place (which I assumed was the CSS files in the wp-admin/css/ folder, in which I could find the exact same CSS rules that were applied to the category box) but for some reason, it’s not retreiving the updated CSS file. Or something else is happening (Server side caching the PHP response and therefore retreiving all the time the old response?)

    Could someone give me a hint?

    Thanks so much!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Its not recommended to edit core wp files directly, because when wp upgrades your changes will be lost, so you can follow below method

    
    function load_custom_wp_admin_style(){
    	 wp_register_style( 'custom_wp_admin_css', get_template_directory_uri() . '/assets/css/admin-style.css', false, '1.0.0' );
        wp_enqueue_style( 'custom_wp_admin_css' );
    }
    add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );
    

    Just put this code in your functions.php file, it will register a css to load in wp admin, then you need to create a file in your theme directory, /assets/css (as per my theme, you can change, but then need to change in code as well) with the name of admin-style.css, then you need to put below code in your newly created css file

    
    #taxonomy-category #category-all{
    	 max-height: none;
    }
    

    This will make your category box without scroll. Let me know if this works for you.

    You can update or modify the themes files but that’s not a right way you should create child theme for modify. to create child theme follow the link below.
    create child theme
    then write the style to particular class in child style.css file that override the style write in parent style sheet.

    Thread Starter maxi123456

    (@maxi123456)

    Hey guys, thanks for your help. Now it’s working as I wanted!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Trying to change CSS on New-Post page (WP-admin)’ is closed to new replies.