::befores in admin-side menu behave differently

i use the following script to use FontAwesome icons as CPT icons,

// Function to add Font Awesome icons to admin menu
function my_font_awesome_admin_icons()
{
    $custom_post_types = get_custom_post_types(); // Get the custom post types

    if (!empty($custom_post_types)) {
        $style = "<style>";
        foreach ($custom_post_types as $post_type => $details) {
            $icon_class = $details["menu_icon"];
            $glyph = $details["icon_glyph"] ?? "";

            // Only process if menu_icon contains 'dashicons-fa'
            if ($icon_class == "dashicons-fa") {
                if ($glyph) {
                    $style .= "
                        #menu-posts-{$post_type} .dashicons-fa::before {
                            font: var(--fa-font-regular)!important;
                            content: '\\{$glyph}'!important;
                            transform: {$glyph};
                        }
                    ";
                }
            }
        }
        $style .= "</style>";
        echo $style;
    }
}
add_action("admin_head", "my_font_awesome_admin_icons");


now this works when the uipress plugin is disabled though if the uipress plugin is enabled it creates their own sidenav and the override does not work

if you need more context for test icons then i’d be happy to provide them

Please authenticate to join the conversation.

Upvoters
Status

In Review

Board

🐛 Bug Reports

Date

7 days ago

Author

Odinn hullekes

Subscribe to post

Get notified by email when there are changes.