For the complete documentation index, see llms.txt. This page is also available as Markdown.

Define an icon

Dashicons is an icon font you can use with your post types.

To set the post type icon pass the dashicon icon slug in the icon() method.

use PostTypes\PostType;

class Books extends PostType
{
    //...

    /**
     * Returns the admin menu icon for the Books post type.
     *
     * @return string
     */
    public function icon(): string
    {
        return 'dashicons-book-alt';
    }
}

A list of available icons can be found on the WordPress documentation

Last updated