0

I installed a plugin that let me add my own css and html to the home page of the dashboard. This is great! However some of my styles are messing up other pages. I could solve this if the home page of the dashboard had a custom body class..

I looked at some example functions on stackoverflow but found nothing specifically targeting the dashboards home page.

Default page location: /wp-admin/index.php

0

If I'm not mistaken, you could just use body.wp-admin.index-php to target the dashboard.

If you want to add something else, you can use the admin_body_class filter to manipulate the classes added to the body and check what is displayed with get_current_screen:

add_filter("admin_body_class", function($classes) {
    $current_screen = get_current_screen();
    if($current_screen->base == "dashboard") {
        $classes .= " dashboard";
    }
    return $classes;
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.