So I’m using this plugin called Mapplic for interactive maps on wordpress
and I’m trying to hide a specific class in it for everyone except admins
so first i added this function to add a class for admin
function add_admin_body_class($classes) {
if (current_user_can('administrator')) {
$classes[] = 'is-admin';
}
return $classes;
}
add_filter('body_class', 'add_admin_body_class');
then i added the CSS code which is
.mapplic-popup-body {
display: none !important;
}
body.is-admin .mapplic-popup-body {
display: flex !important;
now it’s completely not showing the class for everyone including the admins
could anyone help me out with this please ?
so i tried changing the class in CSS from is-admin to wp-admin and it showed the class in the admin dashboard but i wanna see it in the content itself
2
Answers
Try simple CSS.
This will hide the container only if admin is not logged in.
If you want to hide the class mapplic-popup-body for all users except administrators in WordPress, you can use the following code snippet in your theme’s functions.php file:
Feel free to reach out if you have any further questions!