LuckyCoder
LuckyCoder

Reputation: 520

Menu image for custom post type

I'm working with custom post type. I want to use custom menu image for the post type. I know 'menu_icon' => '' should work but couldn't recognize how image path should be specified. I appreciate your help.

Upvotes: 1

Views: 2735

Answers (2)

Alexis
Alexis

Reputation: 31

Other way to do it, if the image you want to add is located in your theme directory, would be:

'menu_icon' => get_template_directory_uri() . '/images/your_custom_icon.png',

Upvotes: 0

Sudar
Sudar

Reputation: 19992

It is better to give the full path to the image. Something like this

'menu_icon' => get_bloginfo('template_directory') . '/images/portfolio-icon.png'

Edit: If you want to include the image from the Plugin directory, then you can use the plugin_url() function. This will make it compatible with WPMU as well.

'menu_icon' => plugins_url('path/to/image',  __FILE__);

Upvotes: 2

Related Questions