Font Awesome in WordPress Backend
Damit kannst du die etwas veralteten Dashicons ersetzen.
Achtung, der Code ist noch WIP. Grössen, Struktur und Abstände müssten noch angepasst werden.
Sass
// ADMINMENU ICONS
// -----------------
/* Font awesome Icons reinladen */
@font-face {
font-family: "FontAwesome";
src: url("/wp-content/uploads/fa-regular-400.woff2") format("woff2");
font-weight: normal;
font-style: normal;
}
/* Example usage for replacing icons */
#adminmenu #menu-dashboard .wp-menu-image:before,
#adminmenu #toplevel_page_independent-analytics .wp-menu-image:before {
font-family: "FontAwesome";
content: "\f015"; /* Example FontAwesome icon unicode */
font-size: 16px;
}
#adminmenu #menu-posts .wp-menu-image:before,
#adminmenu #menu-media .wp-menu-image:before,
#adminmenu #menu-pages .wp-menu-image:before,
#adminmenu #menu-posts-wp_block .wp-menu-image:before,
#adminmenu #menu-appearance .wp-menu-image:before,
#adminmenu #menu-plugins .wp-menu-image:before,
#adminmenu #menu-users .wp-menu-image:before,
#adminmenu div.wp-menu-image:before {
font-family: "FontAwesome";
content: "\f015"; /* Example FontAwesome icon unicode */
font-size: 16px;
display: inline-block !important;
background-image: none !important;
color: white !important;
}
#adminmenu #toplevel_page_wpcodebox2 .wp-menu-image:before {
font-family: "FontAwesome";
content: "\e1df"; /* Example FontAwesome icon unicode */
font-size: 16px;
display: inline-block;
background-image: none !important;
color: white !important;
}
#adminmenu #toplevel_page_rank-math .wp-menu-image:before {
font-family: "FontAwesome";
content: "\f865"; /* Example FontAwesome icon unicode */
font-size: 16px;
display: inline-block;
background-image: none !important;
color: white !important;
}
#adminmenu #toplevel_page_ws-form .wp-menu-image:before {
font-family: "FontAwesome";
content: "\e211"; /* Example FontAwesome icon unicode */
font-size: 14px;
display: inline-block;
color: white !important;
background-image: none !important;
}
/* Website-Titel Icon - Go to Website */
.wp-admin #wpadminbar #wp-admin-bar-site-name>.ab-item:before {
font-family: "FontAwesome" !important;
content: "\f2f5" !important; /* Example FontAwesome icon unicode */
font-size: 14px;
display: inline-block;
color: white !important;
}
/* Seite bearbeiten Icon */
#wpadminbar #wp-admin-bar-edit>.ab-item:before {
font-family: "FontAwesome" !important;
content: "\f044" !important; /* Example FontAwesome icon unicode */
font-size: 14px;
display: inline-block;
color: white !important;
}
/* Website-Titel Icon - Back to Dashboard */
#wpadminbar #wp-admin-bar-site-name>.ab-item:before {
font-family: "FontAwesome" !important;
content: "\e66c" !important; /* Example FontAwesome icon unicode */
font-size: 14px;
display: inline-block;
color: white !important;
}
/* My Account rechts oben */
#wp-admin-bar-my-account>.ab-item:before {
content: "\f007" !important; /* Example FontAwesome icon unicode */
font-size: 14px;
display: inline-block;
color: white !important;
}
/* Updates Icon */
#wpadminbar #wp-admin-bar-updates .ab-icon:before {
font-family: "FontAwesome" !important;
content: "\e13b" !important; /* Example FontAwesome icon unicode */
}
.wp-menu-image.dashicons-before img {
display: none !important;
}
/* hide ws forms and rank math svg admin icons */
#adminmenu div.wp-menu-image.svg {
background-image: none !important;
}