Skip to content

patrik-csak/fa-wp-admin-menu-icons

Repository files navigation

FA WP Admin Menu Icons

FA WP Admin Menu Icons allows you to use Font Awesome icons for WordPress custom post types and custom menu pages by passing the Font Awesome class string, just like using Font Awesome on the front end

Screenshot of WordPress admin dashboard with Font Awesome icons for a custom post type and a custom menu page

Here's an example:

register_post_type( 'custom_post_type', [
    //...
    'menu_icon' => 'fa-solid fa-thumbs-up',
    //...
] );

See Usage for more examples

Requirements

Installation

WordPress Admin Dashboard

In your WordPress Admin Dashboard, go to Plugins > Add New, search for 'fa wp admin menu icons', then click Install Now

Read more about automatic plugin installation with the WordPress Admin Dashboard

WP-CLI

Install with WP-CLI by running the following command:

wp plugin install fa-wp-admin-menu-icons --activate

Install with Composer

  1. Follow the setup instructions for WordPress Packagist
  2. Require wpackagist-plugin/fa-wp-admin-menu-icons

Install with Git

Install with Git by running the following commands:

cd <wp-content>/plugins
git clone git@github.com:patrik-csak/fa-wp-admin-menu-icons.git

Usage

register_post_type()

To use a Font Awesome icon for your custom post type with register_post_type(), use a Font Awesome class string for the $args['menu_icon] parameter:

register_post_type( 'custom_post_type', [
    //...
    'menu_icon' => 'fa-solid fa-thumbs-up',
    //...
] );

add_menu_page()

To use a Font Awesome icon for your custom menu page with add_menu_page(), use a Font Awesome class string for the $icon_url parameter:

add_menu_page(
    page_title: 'Custom Menu Page',
    menu_title: 'Custom Menu Page',
    capability: 'manage_options',
    menu_slug: 'custom_menu_page',
    icon_url: 'fa-solid fa-thumbs-up',
);

Custom Post Type UI plugin

To use a Font Awesome icon with the Custom Post Type UI plugin, use a Font Awesome class string for the Menu Icon field when adding or editing a Post Type:

Screenshot of Custom Post Type UI Menu Icon field populated with 'fa-solid fa-thumbs-up'

Caveats

FA WP Admin Menu Icons only supports Font Awesome's free icons

About

🏳️ Easy Font Awesome icons for WordPress custom post types and custom menu pages

Topics

Resources

License

Stars

Watchers

Forks