I’m trying to remove both padding and the title of the dashboard page of the admin panel of WordPress. The dashboard was redesigned with the "Welcome Dashboard for elementor" + Elementor
.
I tried this script:
var domainURL = window.location.origin;
var path = window.location.pathname;
if ((path == "/wp-admin/" || path == "/wp-admin" || path == "/wp-login.php") && domainURL+path)
{
document.getElementsByClassName("h1").style.display = "none";
}
It is not working. Would you have fixes or ideas to achieve this, please?
2
Answers
You have to inject the css into the wordpress header to actually modify the wordpress css admin console. In your
function.php
file add the following:Now to easily find your the element you want to target and style you can do the following:
In your browser: Right click on the element > Inspect.
Find your element in the source code: Right Click > Copy > Copy selector
Now you can paste your selector in-between the style tag and customize it.
One more thing, you should use the
!important
statement (eg:background-color:red!important
)In general, the
<body>
classes contain a unique class specific to that one page (e.g. page name), you could add this as the first selector to yourCSS
code.CSS
classes to the<body>
tag withadmin_body_class
Additional: For frontend pages you could use
body_class